WPF:ComboBox DisplayMemberPath突然不再显示了?

时间:2010-05-15 20:34:51

标签: wpf data-binding combobox namespaces

在我的ComboBox中我看到3次:MyNameSpace.ViewModel.CustomerViewModel ??

实际上这段代码有效,但现在不知道我改变了什么:

      <ComboBox  DisplayMemberPath="{Binding Path=CustomerName}" SelectedIndex="0" ItemsSource="{Binding CustomersViewModel}" />

客户是ObservableCollection

使用DisplayMemberBinding而不是DisplayMemberPath,相同的代码适用于ListBox。

有什么问题?

1 个答案:

答案 0 :(得分:1)

DisplayMemberPath采用路径,而不是绑定。所以只需设置DisplayMemberPath =“CustomerName”。

相关问题