I am using WPF and MVVM Light framework.
I would like to know how to revert back the selection on a combobox.
For example:
- Default selection is "Text 1"
- When the user select "Text 2" in the combobox, I display a dialog box (Yes/No) to confirm the action
- If the user clicks "No", I want to revert back the value to "Text 1"
So far my xaml is like this:
ComboBox ItemsSource="{Binding SourceData}" SelectedItem="{Binding SelectedSourceData,Mode=TwoWay}"
My binding SourceData is defined in my MainViewModel.cs as:
public ObservableCollection<TextItem> SourceData { get; set; }
I do not have a name for my combobox. Is there any way to revert the selection using a binding method?
Any help would be much appreciated.
Thanks.