Lucas Araujo

Lucas Araujo

  • NA
  • 1
  • 3.3k

Disable combo box item 2 to item 1 combo box is selected

Aug 16 2015 7:55 PM
Good night.
I'm developing an app for WP, but I have a question.
My app has two combobox. Both have the same combobox item that were added in WPF, I wanted to know how to disable the same combo box item the second if the first is already selected.
 
Code:
<ComboBox x:Name="comboBox1">
 <ComboBoxItem Content="Um" Tag="1" IsSelected="True" />
<ComboBoxItem Content="Dois" Tag="2" />
<ComboBoxItem Content="Tres" Tag="3"/>
</ComboBox>
<ComboBox x:Name="comboBox2"> 
<ComboBoxItem Content="Um" Tag="1" IsSelected="True" />
 <ComboBoxItem Content="Dois" Tag="2" />
 <ComboBoxItem Content="Tres" Tag="3"/>
</ComboBox>
That is, if the user opens the first combobox (comboBox1) and select "Two" the ComboBoxItem "Two" does not appear in the second combobox.
And if not chosen anything, by default, the A ComboBoxItem would no longer showing on ComboBox2 as it is already IsSelected.
 

Answers (2)