I have a ListBox with its ItemsSource set to an ObservableCollection
In an effort to enabling sorting, I changed it so that a CollectionViewSource object is set up to use the same ObservableCollection
It works, but there is one quirk. Whenever my application loads, the last item in the ListBox is “pre-selected”. I assume this is happening due to the CollectionViewSource.View.CurrentPosition being set after the sort operation.
I am having to undo this auto-selection, and set up temporary blocking of the ListBox’s SelectionChanged event while it is automatically set and manually unset. It works, but I do not like this – it feels like messy, unnecessary code.
Is there a way to link a ListBox to a CollectionViewSource.View without any selection being automatically made? Or any other tips?
Hi rizzlwizzl,When the