I have an MVVM collection that I “know” is reordered in the VM but not showing in it’s new order in the view. Given code similar to that below, should I expect the the list to re-display in a new sort without manipulating the CollectionViewSource?
xaml
<Menu Name="_mainMenu" Height="22" >
<MenuItem Header="Language"
ItemsSource="{Binding AvailableCultures}" >
<MenuItem.ItemTemplate>
<DataTemplate>
<MenuItem IsCheckable="True"
IsChecked="{Binding IsSelected, Mode=TwoWay}"
Header="{Binding DisplayName}"/>
</DataTemplate>
</MenuItem.ItemTemplate>
</MenuItem>
</Menu>
vm
public ObservableCollection<OptionLocalizedViewModel<CultureInfo>>
AvailableCultures { get; private set; }
private void OnSelectionChange(OptionLocalizedViewModel<CultureInfo> option)
{
...
var sorted = AvailableCultures.OrderBy(x => x.DisplayName);
AvailableCultures =
new ObservableCollection<OptionLocalizedViewModel<CultureInfo>>(sorted);
NotifyOfPropertyChange(() => AvailableCultures);
}
UPDATE
The order is being changed, but not as expected (and not what the debugger shows the newly sorted ObsCollection to be). I also tried ditching the ObsCollection in favor of binding to an IEnumerable directly with the exact same result.
Does anyone see a pattern that suggests a fix??
1) initial load, looks as it should

2) select Spanish, so should be Espanol first but isn’t

3) back to English, but somehow English is last. How did this get flipped?

4) back to Spanish, same as try (2)

This should theoretically work, just be sure INotifyPropertyChanged is actually getting fired correctly as it is necessary when replacing the entire collection with a different one rather than just altering it’s contents.