Binding a WPF ComboBox to a custom list

后端 未结 4 604
暗喜
暗喜 2020-11-22 11:59

I have a ComboBox that doesn\'t seem to update the SelectedItem/SelectedValue.

The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch

4条回答
  •  [愿得一人]
    2020-11-22 12:32

    I had what at first seemed to be an identical problem, but it turned out to be due to an NHibernate/WPF compatibility issue. The problem was caused by the way WPF checks for object equality. I was able to get my stuff to work by using the object ID property in the SelectedValue and SelectedValuePath properties.

    
    

    See the blog post from Chester, The WPF ComboBox - SelectedItem, SelectedValue, and SelectedValuePath with NHibernate, for details.

提交回复
热议问题