ComboBox Data Binding
- ItemsSource (IEnumerable): Defines the collection of the items that will populate the control with data.
- DisplayMemberPath (string): Defines the name of the property which will be visualized inside the drop-down list.
If DisplayMemberPath is not set the “ToString” implementation of the business object will be visualized. The DisplayMemberPath is a property that helps the developers to visualize an exact property from the business object they are bound to.
Binding to a complex object
Here is the ComboBox definition in XAML:
In addition to this, you need to add the following namespace:
the sample business model
and the ViewModel used: