Wpf – How to rollback selected SelectedValue of the combo box using WPF MVVM

mvvmwpf

I have something like it will pop to the user for getting confirmation of changes. If he clicks no I am setting the selectedValue in view model to the previous selection. But its not getting displayed correctly in view. Please help.

Best Solution

Very simple solution for .NET 4.5.1+:

<ComboBox SelectedItem="{Binding SelectedItem, Delay=10}" ItemsSource="{Binding Items}"  />

It's works for me in all cases. Just fire NotifyPropertyChanged without value assignment to rollback.