문제

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
   }
}
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top