MVVM paging & sorting

前端 未结 2 402
一向
一向 2020-12-15 13:00

I am struggling with finding an adequate solution to impletmenting Sorting and Paging for a WPF DataGrid that conforms to the MVVM P&P.

The following example ill

2条回答
  •  孤街浪徒
    2020-12-15 14:00

    You should use a collection property of type ListCollectionView in your ViewModel, and bind the Grid to it. That way the CollectionView definition would not sit in the View but instead in the ViewModel (where it belongs) and that would help you do all the manipulations you want easily in the ViewModel (be it paging, sorting or filtering)

提交回复
热议问题