Skip to content

Instantly share code, notes, and snippets.

@idiotandrobot
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idiotandrobot/d7c30aac470af4900cb5 to your computer and use it in GitHub Desktop.
Save idiotandrobot/d7c30aac470af4900cb5 to your computer and use it in GitHub Desktop.
Simple Listbox Ordering using a CollectionViewSource
<ListBox ItemsSource="{Binding List}" />
xmlns:cm="clr-namespace:System.ComponentModel;assembly=System.Windows"
<CollectionViewSource x:Key="ListViewSource" Source="{Binding List}">
<CollectionViewSource.SortDescriptions>
<cm:SortDescription PropertyName="Name" Direction="Ascending" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<ListBox ItemsSource="{Binding Source={StaticResource ListViewSource}}" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment