开发者

WPF: ComboBox DisplayMemberPath is suddenly not shown anymore?

开发者 https://www.devze.com 2022-12-30 04:39 出处:网络
in my ComboBox I see 3 times this: MyNameSpace.ViewModel.CustomerViewModel ?? Actually this code worked but now don`t know what I changed:

in my ComboBox I see 3 times this: MyNameSpace.ViewModel.CustomerViewModel ??

Actually this code worked but now don`t know what I changed:

      <ComboBox  DisplayMe开发者_如何学PythonmberPath="{Binding Path=CustomerName}" SelectedIndex="0" ItemsSource="{Binding CustomersViewModel}" />

Customers is a ObservableCollection

The same code works fine with a ListBox just using DisplayMemberBinding instead of DisplayMemberPath.

What is wrong?


DisplayMemberPath takes a path, not a Binding. So just set DisplayMemberPath="CustomerName".

0

精彩评论

暂无评论...
验证码 换一张
取 消