I’m struggling to get paging and sorting (on multiple headers) going on using MVVM in WPF.
I’ve got paging working using a custom control and sorting also kind of works but not quite.
I can handle the event Sorting event binding a command to it get the SortDescriptions (ICollectionView) do the sorting over the pages. This works with multiple header.
The only thing is, when I don’t set handled on DataGridSortingEventArgs the client also sort. That I don’t want, but when I set DataGridSortingEventArgs is handled the sort indicator doesn’t indicate…..
— Result —
-
Implemented custom paging.
-
Use binding on SortDirection for each header in the DataGrid.
-
Handled DataGrid Sorting event (using GalaSoft)
2.1. Set argument to handled
2.2. Set direction on column manually(from args)
2.3. Remove SortDescriptions using the binding from 2 (the ones with no sort direction)
2.5. Insert SortDescription from column on ICollectionView
Presto. It work as I need it.
You can cancel the event and set the SortDirection “manually”