Q:

How to set combox item visibility?

i have 2 WPF comboboxes(comboboxA, comboboxB)with identical combobox item(Apple & Orange). Let say i select "Apple" in the comboboxA, then the "Apple" need to be hidden in the comboxB. If i go back to comboxA and select "Orange", "Apple" will be visible and "Orange" need to be hidden. How can i achieve that using C#?
code snippet for xaml:
    <ComboBox Name="comboboxA" >
        <ComboBoxItem Content="Apple" Name="AppleA"></ComboBoxItem>
        <ComboBoxItem Content="Orange" Name="OrangeA"></ComboBoxItem>
    </ComboBox>

    <ComboBox Name="comboboxB" >
        <ComboBoxItem Content="Apple" Name="AppleB"></ComboBoxItem>
        <ComboBoxItem Content="Orange" Name="OrangeB"></ComboBoxItem>
    </ComboBox>

A:

You can use the Method that sa_ddam213 mentioned, or you can just brute force it in the SelectionChanged Event like so.
private void comboboxA_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    for (int i = 0; i <= comboboxB.Items.Count -1; i++)
    {
        if (((ComboBoxItem)(comboboxB.Items[i])).Content.ToString() == ((ComboBoxItem)comboboxA.SelectedItem).Content.ToString())
        {
            ((ComboBoxItem)(comboboxB.Items[i])).Visibility = System.Windows.Visibility.Collapsed;
        }
        else
            ((ComboBoxItem)(comboboxB.Items[i])).Visibility = System.Windows.Visibility.Visible;
    }
}

