Wpf ComboBox Problem

May 29 2013 7:55 PM
Hey guys.

I have two ComboBoxes both have exactly the same Items. My Problem ist that I want to select an item in the first ComboBox, which should be deleted in the second. But it doesn't work. 


Die Events:

 private void cb_StoneCoordinates1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //cb_StoneCoordinates2.Items.RemoveAt(cb_StoneCoordinates1.Items.IndexOf(cb_StoneCoordinates1.SelectedItem));
            cb_StoneCoordinates2.Items.RemoveAt(cb_StoneCoordinates1.SelectedIndex);


        }


        private void cb_StoneCoordinates2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //cb_StoneCoordinates1.Items.RemoveAt(cb_StoneCoordinates2.Items.IndexOf(cb_StoneCoordinates2.SelectedItem));
            cb_StoneCoordinates1.Items.RemoveAt(cb_StoneCoordinates2.SelectedIndex);
        }




Hier noch ein Bild meiner Andwendung, http://tempuri.org/tempuri.html



Answers (2)