Binding PropertyName of CollectionViewSource SortDescription in Xaml
- by Faisal
Here is my xaml that tells the collectionviewsource sort property name.
<CollectionViewSource Source="{Binding Contacts}" x:Key="contactsCollection" Filter="CollectionViewSource_Filter">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="DisplayName" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
The xaml above works fine but problem I have is that I don't know how to give a variable value to SortDescription PropertyName. I have a property in my viewmodel that tells which property to sort on but I am not able to bind this property to SortDescription's PropertyName field.
Is there any way?