MadSeb
MadSeb

Reputation: 8234

WPF datagrid : how to sort a column programatically?

How do I sort a column programatically ?

I would like to have a function such as

myWPFDataGrid.Columns[0].Sort(..)

MadSeb

Upvotes: 2

Views: 3220

Answers (1)

Aren
Aren

Reputation: 55946

Use an ICollectionView as your ItemsSource and CollectionViewSource to generate it. You can set the sort descriptions there and it'll sort your items for you.

Upvotes: 1

Related Questions