Simple Listbox Ordering using a CollectionViewSource

history edit


As with most xaml based apps there are any number of ways of ordering a list of items. A quick and straightforward way to do this entirely in xaml is to use a CollectionViewSource.

This example will order a bound list ‘List’ based on the listed object’s ‘Name’ property.

The SortDescription binding is clever enough to raise an error if the property selected doesn’t implement IComparable.