2

How do I sort a column programatically ?

I would like to have a function such as

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

MadSeb

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.