Mutually Exclusive comboboxes that binds to same data source - MVVM implementation
I'm not sure my Title is right but this is the problem I am facing now.. I have the below XAML code..
<ItemsControl ItemsSource="{Binding Path=FieldMapping}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ComboBox ItemsSource="{Binding Path=AvailableFields}"
SelectedItem="{Binding Path=SelectedField}"
></ComboBox>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
What this basically does is, If my data source contains ten items, this is going to generate 10 row of comboboxes and all comboboxes are bounded to the same itemsource.
Now my requirement is Once an item is selected in the first combo box, that item should not be available in the subsequent combo boxes. How to satisfy this requirement in MVVM and WPF?
Re: Mutually Exclusive comboboxes that binds to same data source - MVVM implementatio
You'll need to add the logic to the VM to remove the selected item from the subsequent lists when a user makes a selection. I doubt there is a xaml only solution, so you'll probably need to handle the selectchange event.