DataGrid.Items.Refresh has no effect if the grid was sorted

Feb 26, 2010 at 11:50 AM

Hi,

Found a weired problem: I bound a List<> to the ItemSource. When I update an item in the list, and call DataGrid.Items.Refresh the updated item is displayed.

However, if the user sorted the datagrid before, the Refresh has no effect.

I made a workaorund using CollectionViewSource.GetDefaultView and Refresh that, but it's not very elegant.

Anyone else had this problem?

Regards

Oliver

Apr 15, 2010 at 7:59 PM

Hi Oliver,

I am also facing the same issue. Can you please elavorate the workaround mentioned above. anyway in my grid the number of rows will not be more than 50 so i think it will be ok for me.

Thanks & Regards,

Shyam Sohane

Apr 16, 2010 at 3:58 PM
Hi Shyam,

Actually pretty simple:

CollectionViewSource.GetDefaultView([Your DataGrid Object].ItemsSource).Refresh();


From: [email removed]
To: [email removed]
Date: Thu, 15 Apr 2010 11:59:10 -0700
Subject: Re: DataGrid.Items.Refresh has no effect if the grid was sorted [wpf:199503]

From: shyamsohane
Hi Oliver,
I am also facing the same issue. Can you please elavorate the workaround mentioned above. anyway in my grid the number of rows will not be more than 50 so i think it will be ok for me.
Thanks & Regards,
Shyam Sohane
Read the full discussion online.
To add a post to this discussion, reply to this email (wpf@discussions.codeplex.com)
To start a new discussion for this project, email wpf@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Angst vor Spam? Hotmail schützt Sie mit modernster Technologie!