I have following collection view
<CollectionViewSource x:Key="messages" Source="{Binding src}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Group"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
Then I assign it to TreeView's ItemsSource. Now, how to sort Groups by their name? They appear to have random order.
Just sort by the group. This should work:
<CollectionViewSource x:Key="messages" Source="{Binding src}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Group"/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<SortDescription PropertyName="Group" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With