If I have an unsorted collection, there is an easy way to link and sort it. I would like to do this in XAML (no Linq, no C #)
If my DataContext has a property, say, MyItems, it's easy to bind it:
<ListBox ItemsSource={Binding MyItems}/>
However, I would also like to sort it. Using CollectionViewSource should be a solution, but it does not work for me:
<ListBox> <ListBox.ItemsSource> <Binding> <Binding.Source> <CollectionViewSource Source={Binding MyItems}/> </Binding.Source> </Binding> </ListBox.ItemsSource> </ListBox>
At this point, my ListBox is losing its items. Am I missing something?
source share