De Tran
De Tran

Reputation:

grouping with order?

In WPF, I can group, but the default is group with ascending. One of my need to to be able to control the sorting of the group (Ascending or descending). For example:

group 1

group 2

and also be able to switch to:

group 2

group 1

Upvotes: 1

Views: 2296

Answers (1)

Bryce Kahle
Bryce Kahle

Reputation: 8227

You had the right idea. Add a SortDescription to the ICollectionView based on the same property you are grouping on. If you want to change sort directions, you have to clear the existing one and add a new for the opposite direction. You can't change it once its created as you discovered.

Upvotes: 2

Related Questions