Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sorting and filtering options in WPF Datagrid?

I installed the most recent WPF toolkit and used the Datagrid control. The list of items is showing with automatically-generated columns based on my IList as ItemsSource.

I was wondering if there is an OOTB way to have filtering/sorting on this grid?
A way to click the header to make it sort, or use a dropdown in the header that shows all the possible values so that column is filtered on that property.

Right now my grid is just a fancy list of items.

like image 201
Boris Callens Avatar asked Oct 08 '09 09:10

Boris Callens


1 Answers

To enable filtering, sorting and grouping, you can use the ICollectionView interface. See this post for more information.

To enable sort when clicking the column header, you can set to true the CanUserSortColumns of the DataGrid control.

like image 120
japf Avatar answered Nov 03 '22 22:11

japf