First off let me just say I'm very new to coding so there are big gaps in my knowledge... anywho:
Right, I'm trying to sort a WPF listbox when a button is clicked, preferrably in pure xaml (otherwise VB). I'm having a hard time seeing as most samples are written in C#. Here's 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, what I want to do is add a button like so:
<Button x:Name="SortNameAsc"
Content="Sort By Name"
Visibility="Visible">
Now when this button is clicked, I'd like the listbox to sort by the field "First Name", I assume I have to change the sort description somehow, so could anyone tell me how please? Or am i going about this hte worng way. Again preferabbly in XAML, but if need be in VB could you try and keep it simple please??
Thanks guys