I want to bind a class member of an element I added to a collection to DisplayMemberPath
. I bound a ObservableCollection
to ComboBox.ItemSource
and want to show the property name
in the combobox's list which is a member of my class AxisBase
.
Here is my code:
private ObservableCollection<AxisBase> axis { get; set; }
axis
I use to hold elements of the following class
class AxisBase
{
...
public string name { get; set; }
...
}
This is how my xaml looks like
<ComboBox Name="comboBox_AchsenListe" DisplayMemberPath="{Binding ElementName=axis, Path=AxisBase.name}" ItemsSource="{Binding ElementName=_MainWindow, Path=axis}"</ComboBox>
Does anyone know how to bind name
to DisplayMemberPath
?