在我的ComboBox中我看到了3次: MyNameSpace.ViewModel.CustomerViewModel ??
实际上这段代码起作用了,但是现在我不知道我修改了什么:
      <ComboBox  DisplayMemberPath="{Binding Path=CustomerName}" SelectedIndex="0" ItemsSource="{Binding CustomersViewModel}" />Customers是一个ObservableCollection
同样的代码也适用于ListBox,只是使用DisplayMemberBinding而不是DisplayMemberPath即可。
怎么啦?
发布于 2010-05-16 04:40:15
DisplayMemberPath采用路径,而不是绑定。所以只需将DisplayMemberPath=设置为“CustomerName”即可。
https://stackoverflow.com/questions/2841661
复制相似问题