I have an ItemsControl with the following binding :
ItemsControl ItemsSource="{Binding SelectedItems}
There are 10 SelectedItems in the collection, each having a Combo Box with this binding :
ComboBox ItemsSource="{Binding SelectableItems}
When a SelectableItem is selected the SelectedItems ObservableCollection is updated. I would then like the SelectableItem to be disabled, so it cannot be selected in any of the other combo boxes.
The number of SelectableItems is not equal to the number of SelectedItems.
I have the following style on a ComboBoxItem :
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="IsEnabled" Value="{Binding IsSelectable}"/>
</Style>
This works fine on Start up - but the problem is because I'm updating the SelectedItems ObservableCollection, I'm not updating the SelectableItems collection..
Is there anything (LINQ?) I can put in SelectedItem.PropertyChanged event to update the relevant item in the SelectableItems collection - so something like :
public void SelectedItemObservableCollectionPropertyChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged("SelectableItem.IsSelectable");
}
If not, what is the best workaround?