Reputation: 627
I have a complex list as a resource in the following form:-
sectionList
Sections
Section 0
Section 1
.
.
Section 12
Each of those have few properties like 'Name', ie. Section 0 have a property 'Name' and so on.
In my Xaml i have a ComboBox which i want to bind it's ItemsSource to get the Name property of each Section in this ComboBox. When i use ItemsSource="{Binding Path=Section}" i get only a list of the Types not the actual Name property. With that i mean the list looks like below:-
AppName.ClassName+Section (This is the Type)
AppName.ClassName+Section
.
.
.
AppName.ClassName+Section
So my question is, how to get the property Name instead of the Type in this ComboBox?
Hope this an enough discription otherwise i will be more than glad to explain more.
Upvotes: 0
Views: 133
Reputation: 2054
Use 'DisplayMemberName' on the combobox to pass in the name of the field you wish to display.
See WPF Combobox DisplayMemberPath for a usage example (use the solution, not the question as it is incorrect!)
Upvotes: 1