Quirk when ListBox.ItemsSource = CollectionViewSource.View

I have a ListBox with its ItemsSource set to an ObservableCollection object. When my application loads, the list is populated as expected, with no selection.

In an effort to enabling sorting, I changed it so that a CollectionViewSource object is set up to use the same ObservableCollection along with a SortDescription, and the ListBox’s ItemsSource now points to the CollectionViewSource.View

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