|
I would ask on the toolkit site and/or post it as an omitted feature.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks I will do that. If you have any opinion on what is the best way to refresh a grid, or refresh a collection please let me know, thanks..
Bijesh
|
|
|
|
|
The control should really do that itself.
Off the top of my head, things to try:
1) DataGrid.InvalidateProperty()
2) detach and re-attach the collection ( )
The control's not officially released so it would be nice to catch
stuff like this before it goes into the .NET framework
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
From what I've tried so far, gettng the efault view of the collection is what work, but the performance is not great. detaching and attaching, seems very wrong, but I might go for it, as it has the advantage that I can effectively suspend the grid, do a batch of updates to the underlying data and then refresh the grid, rather than have the grid continuously update itself..
Again thanks for the responses...
Bijesh
modified on Tuesday, June 23, 2009 8:40 AM
|
|
|
|
|
OK - this is odd. I knocked up a quick sample application and sorted on a column - then I started changing the values in the sorted column and it refreshed and changed the sort order in every case. Here's the sample code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Media3D;
using System.ComponentModel;
using System.Collections.ObjectModel;
namespace ModelVisualTest
{
public partial class Window1 : Window
{
private ObservableCollection<Person> _people;
public Window1()
{
InitializeComponent();
}
private void BuildModel()
{
_people = new ObservableCollection<Person>();
_people.Add(new Person() { Forename = "Peter", Surname = "O'Hanlon", Age = 30 });
_people.Add(new Person() { Forename = "Josh", Surname = "Walton", Age = 29 });
_people.Add(new Person() { Forename = "William", Surname = "Hill", Age = 28 });
_people.Add(new Person() { Forename = "Joseph", Surname = "Brannagan", Age = 36 });
dataGrid1.ItemsSource = _people;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
BuildModel();
}
}
public class Person : INotifyPropertyChanged
{
private string _forename;
public string Forename
{
get { return _forename; }
set
{
if (_forename != value)
{
_forename = value;
OnChanged("Forename");
}
}
}
private string _surname;
public string Surname
{
get { return _surname; }
set
{
if (_surname != value)
{
_surname = value;
OnChanged("Surname");
}
}
}
private int _age;
public int Age
{
get { return _age; }
set
{
if (_age != value)
{
_age = value;
OnChanged("Age");
}
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnChanged(string p)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(p));
}
}
#endregion
}
} The XAML is simply this:
<Window x:Class="ModelVisualTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit"
Loaded="Window_Loaded" >
<Grid>
<my:DataGrid x:Name="dataGrid1" AutoGenerateColumns="True" />
</Grid>
</Window>
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hmm that is really odd.. Thanks for posting the code sample. I'll try it out at the earliest.. (unfortunately had to get into some other work for now)
|
|
|
|
|
Hi Pete,
Just tried out your sample. If I understood correctly you are manually editing the values? That works fine for me too. BEcause I think a manual edit ends up firing a collectionChanged event and this takes care of resorting the grid. This is probably fine performance-wise too as a manual edit is not doing to happen numerous times a second.
My issue is with updates being done on the data programatically to a sorted column, do not seem to readjust the sorting. This seems like a generic requirement and it should do it automatically, or atleast provide an option to have it done automatically. Why would we want to have a grid that appears to be sorted but it actually not?
Bijesh
|
|
|
|
|
is there any workflow designer for workflow WF?
bah10z
bah10z
|
|
|
|
|
engbahramZarin wrote: is there any workflow designer for workflow WF?
Errm. Yes. It's in Visual Studio. I may be missing something about your question though...
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Not in the express edition according to this article[^].
Eslam Afifi
|
|
|
|
|
Hello.
Not being proficient in designing vector graphics, I would like to convert an existing glyph from a font to a WPF shape/path.
To be more specific I need a square root symbol from the OpenSymbol font, as well as other math stuff. I prefer having them as shapes because I want to have more control over scaling and actual appearance. Additionaly I could modify them which is easier than creating from scratch.
Is there a way to do that automatically?
Secondary wish: Convert a vector graphics from PaintShop Pro to vector graphics in WPF.
Thanks.
Greetings - Jacek
|
|
|
|
|
Dunno about the font, or Paint Shop Pro, but Blend Design converts vector files from Adobe Illustrator to XAML. So, that's where I would look for other formats, too.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks for your reply.
So I need both Expression Design and Adobe Illustrator to do this simple task...? I have been googling for a PSP->AI converter but I haven't found anything applicable so far . BTW I have the Expression Studio installed. Do you know any freeware converters? I am really poor at drawing.
I know that "Switch anything to a WPF shape" would be a great title for a CP article, but...
Greetings - Jacek Gajek
|
|
|
|
|
Jacek Gajek wrote: So I need both Expression Design and Adobe Illustrator to do this simple task...?
I was more saying that I know Expression does AI, but I don't know what other formats it does. I do recall converting a font character to vectors in C# at one point, I believe there's a way to get a Path object in GDI+ from a font/string combination. Not sure where you'd go from there.
I really don't know exactly how to do what you want, I'm just trying to throw out what I do know, in case it helps. And yes, I think that the Expression product is an attempt to turn VS into two products, so we devs have to spend more money.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
It looks like I'm on my own again . Thanks for help and good night (it's 2 am here).
EDIT:
Christian Graus wrote: I don't know what other formats it does
I forgot to write that I checked it out. It does: {supported formats screenshot}[^]
Greetings - Jacek Gajek
|
|
|
|
|
Did you try starting with a PNG of the character, at a decent size, and see if it will convert it to XAML for you ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
What you could do is run bitmap representations of your fonts through Vector Magic[^] and use the resultant vectors.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks for your reply.
Pete O'Hanlon wrote: run bitmap representations of your fonts through Vector Magic
Oh I wouldn't need any of that. I run TrueType fonts [^], so I seek for a vector-to-vector conversion
The problem is that there are tons of various vector-to-vector format converters and only one (mentioned by Christian) which can do {(whatever)=>(WPF shape)} conversion, which is very commercial.
Greetings - Jacek Gajek
|
|
|
|
|
Fair enough, but you might want to see what Inkscape[^] could do for you. It converts to XAML internally, and is a vector based editing tool like Illustrator.
[EDIT]
I've just converted a piece of text in it into a Path with no problem. It's pretty easy.
[/EDIT]
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you o thank you!
I can convert a text to curves in PS, save as WMF, import in InkSpace, save as XAML and woohoo it works.
Greetings - Jacek Gajek
|
|
|
|
|
You are more than welcome.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi All,
I am new to silverlight. I am creating a silverlight page of 1200 width and 2000 height dimensions. When the page is displayed the vertical or the horizontal scrollbars are getting displayed and hence the page appears cut. Please help me out to solve this issue or provide appropriate pointers.
Thanks in advance for your time.
Sunil
|
|
|
|
|
sunilkpv wrote: When the page is displayed the vertical or the horizontal scrollbars are getting displayed and hence the page appears cut. Please help me out to solve this issue
What do you WANT to happen?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
I want the silverlight web page to have scrolling capability. At present when i build and test the solution, the web browser doesn't display the contents completely as the contents are extending beyond the web browser window. I am not able to scroll it either horizontally nor vertically to see the full page contents because silverlight is not showing any (auto)scrollbars.
How could this problem be overcome?
NOTE: My silverlight canvas height is 1200 and width is 1500. Hence the web browser doesn't display the contents completely.
Thanks.
Sunil
|
|
|
|
|
<UserControl x:Class="SilverlightTester.LargeScrollyPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
<Canvas Width="1500" Height="1200" Background="LightSteelBlue" />
</ScrollViewer>
</UserControl>
Note: No Width/Height specified on UserControl.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|