Boris Callens
Boris Callens

Reputation: 93357

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.

Upvotes: 7

Views: 16137

Answers (1)

japf
japf

Reputation: 6728

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.

Upvotes: 8

Related Questions