views:

35

answers:

1

Hi,

How do I sort a column programatically ?

I would like to have a function such as

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

MadSeb

+1  A: 

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.

Aren
A link that does this: http://wpf.codeplex.com/Thread/View.aspx?ThreadId=35944
karmicpuppet
You don't really need to use it as the ItemsSource. By getting the default collection view, WPF will automatically pick up the sorts you add to it.
Abe Heidebrecht