I'd like to enable/disabled 'CheckBox' element according to which 'ComboBoxItem' is selected. I don't know how to implement this function by using WPF binding.
More specifically, here is my xaml code.
<ComboBox x:Name="typeComboBox" SelectedValuePath="Tag">
<ComboBoxItem Content="type1" Tag="1"></ComboBoxItem>
<ComboBoxItem Content="type2" Tag="2" IsSelected="True"></ComboBoxItem>
</ComboBox>
<CheckBox x:Name="mode" Content="Mode"
IsEnabled="{Binding ElementName=typeComboBox, Path=SelectedValue??}"/>
I want that only when 'type2' is selected, 'mode' is enabled. If 'type1' is selected, 'mode' should be disabled. Could I bind 'IsEnabled' property of 'CheckBox' to 'selectedValue' property of 'ComboBox'?
I had attempted to implemente this function as 'SelectionChanged' event, but 'NullReferenceException' occured. So I'm trying to make it by using WPF Binding.