Hello. I create a project using MVVM pattern. I create a wpf form with comboBoxes. In ViewModel I create ObservableCollection for ItemsSource for comboBoxes with string values:
public ObservableCollection<string> ComboBoxItems { get; set; }
Also in ViewModel constructor I create list of Models (for each comboBox). My Model class have only two properties: SelectedItem and IsEnabledItem.
I want to have a logic like if I select one item in one comboBox it shoud be disable in this comboBox and in all others. How could I do this with Binding? Now my xaml code look like this, but it disabled only selected comboBox item and only in one comboBox, where he was called from:
<ComboBox ItemsSource="{Binding ComboBoxItems}" SelectedItem="{Binding SelectedItem }" IsEditable="True"><ComboBox.ItemContainerStyle><Style TargetType="ComboBoxItem"><Setter Property="IsEnabled" Value="{Binding IsEnabledItem}" /></Style></ComboBox.ItemContainerStyle></ComboBox>
Thanks for your help.