This is a migrated thread and some comments may be shown as answers.

Refresh Data / Sorting from ViewModel

1 Answer 461 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel Knoll
Top achievements
Rank 1
Daniel Knoll asked on 21 Aug 2012, 02:59 PM
Hi,



I'm using the WPF RadGridView in an MVVM architecture.



My grid is sorted using a SortDescriptor defined on an "Order" property in XAML. The user is able to change the order using different ContextMenu Buttons. When I change the Order Property of the items in my ItemsSource, the changes are visible in the grid, but the sorting is not updated. Which means, the items are sorted in a wrong order.



How do I refresh the ItemsSource in my ViewModel? I do not want to aquire a reference to my RadGridView and call the Rebind() method.



Greets

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 22 Aug 2012, 02:03 PM
Hello,

The filter will be automatically re-applied when the bound source collection raises CollectionChanged event. If the Action is Reset, the grid will re-create its entire view. It the Action is Add or Remove with a single item, the grid will evaluate its FilterDescriptors. So you could remove a data item, edit its Value property and then add it back to the collection again.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Daniel Knoll
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or