Question

I have two ComboBoxes in WPF. I have a bit crisis with their events. When I use the event of ComboBox1_SelectionChanged, I want to get two selectedValues, but ComboBox2 doesn't get value because there is no event How to solve this? Any suggestion?

private void ComboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
   if (ComboBox1.SelectedValue == "Shoe" && ComboBox2.SelectedValue == "Nike")
   {
      //TODO
   }
}
Was it helpful?

Solution

Hi user1358072 I think you should set SelectedIndex="0" of combobox2 in xaml code.

It is working on my side .

If you want to handle event for both combo box create event handler for both. and set

SelectedIndex="0" for both.

I think it will useful for You

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top