开发者

When clicking on Datagrid ColumnHeader - How is sorting taking place? And how to override it?

开发者 https://www.devze.com 2023-03-08 04:30 出处:网络
When clicking on a DataGrid ColumnHeader, the datagrid would automatically sort the data, if the underlying dataSource is a CollectionView.

When clicking on a DataGrid ColumnHeader, the datagrid would automatically sort the data, if the underlying dataSource is a CollectionView.

How does it work internally, does it just add SortDescriptors() to the View in order to sort or does it utilize an IComparer class?

I think its rather using SortDescriptors, hence its so slow in sorting.

I have done some research and it says using

CollectionView.CustomSort = a class implementing IComparer is much faster approach.

So in order to try this approach, how do I override the automatic sorting mechanism of DataGrid - when clicked on a columnheader - and do my own sorting with the CustomSort?

Any help on this is highly appreciated.开发者_JAVA百科


You can use the Sorting Event which will give you the Column they are using to sort and in which direction.

0

精彩评论

暂无评论...
验证码 换一张
取 消