First of all, let me say that I am very new to coding, so there are big gaps in my knowledge ... anywho:
That's right, I am trying to sort the WPF list at the click of a button, preferably in pure xaml (aka VB). It's hard for me to see how most samples are written in C #. Here is my code:
<Grid.Resources>
<CollectionViewSource x:Key="myCollectionView"
Source="{Binding Path=Query4, Source={x:Static Application.Current}}" >
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="ContactID"
Direction="Descending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Grid.Resources>
<ListBox x:Name="ContDefault"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Source={StaticResource myCollectionView}}"
ItemTemplate="{StaticResource ContactsList}" />
Now I want to add a button like this:
<Button x:Name="SortNameAsc"
Content="Sort By Name"
Visibility="Visible">
Now that this button is pressed, I would like the list to be sorted by the "Name" field, I assume that I need to somehow change the sort description, so can someone tell me how to do this? Or am I going about this way. Again, preferable in XAML, but if you need to be in VB, you can try and keep it simple, please.
Thanks guys,