WPF combo box weird problem

2019-07-02 20:50发布

I am binding a SortedListbox to an WPF combo box. everything was fine. The problem happend when i select the first [only the first] item. The problem is that SelectedValue doesnt change when a new item is selected after selecting first item. Suppose SelectedValue of the first item is '1' and the SelectedValue of third item in the combo is '3'. If i select the first item and then selected the third item. SelectedValue remains'1', when '3' is expected.

Any 1 faced similar problems.

Regards,

John.

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-02 21:26

Maybe you can try to use IsSynchronizedWithCurrentItem on your control.

<ComboBox IsSynchronizedWithCurrentItem="True" />
查看更多
等我变得足够好
3楼-- · 2019-07-02 21:26

Unless you post the code for the combobox from xaml page, you won't be able to find the reason. Maybe your ComboBox.SelectedValue or ComboBox.SelectedItem isn't defined properly but nothing worthy can be said until code is seen

查看更多
登录 后发表回答