I am using XamDataGrid bound to an ObservableCollection<RecordViewModel> in my ViewModel.My application is subscribed to receive real time notifications of data changes (Insert/Update/Delete) and I need to reflect these changes on the datagrid.So far I have the mechanism to add a new record to ObservableCollection, and it seem to work fine. What I need to achieve next is have the grid show the records in the descending order so that the last one will appear on the top. I have a field "MOD_TIME" in my RecordViewModel which contains the timestamp when the record is generated/updated.I tried adding the code in my XamDataGrid:FieldLayout Xaml
<igDataGrid:FieldLayout.SortedFields> <igDataGrid:FieldSortDescription Direction="Descending" FieldName="Mod_time" /></igDataGrid:FieldLayout.SortedFields>
Thx, Sagar
I noticed that the RefreshSort does not work if Grid in the Group display mode , any way to resolve .
Thanks
Thanks Sam .
However , if the data changes are due to Real Time Data Source. Should
RefreshSortPosition() be called . And what the the best approach to get notified from Grid when the bond data are change.
If you sort a column (asc/desc), and then change the value on that column, you should see the proper sort sequence applied as soon as you focus away from the cell. I just noticed that in my previous answer I said "...if not Reintialized call RefreshSortPosition..." - it sould have been "if Reinitialized" then call RefreshSortPosition, because the grid does reinitialize on changes to its cells, but it does not apply the sort by default.
Sam
Hi Sam ,
This working for adding records , can you advice how to handle if the data are updated .
For instance I have three rows in order like
1 a
2 b
3 c
After update second row to e , my grid stay as
2 e
What I am looking for is
Can you please advice
Ming
Thanks Sam. Just tried out. So far, no issues. Will get back if it causes any issue (which I doubt it will :D)