WPF combo box weird problem

懵懂的女人 提交于 2019-12-12 15:30:10

问题


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.


回答1:


Maybe you can try to use IsSynchronizedWithCurrentItem on your control.

<ComboBox IsSynchronizedWithCurrentItem="True" />



回答2:


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



来源:https://stackoverflow.com/questions/4657028/wpf-combo-box-weird-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!