I bind MyListBox
to a List of MyObject instances. MyObject contains a string field named TextField. I want to bind every item in listBox to MyObject.TextField
. My code is the following, but it doesn't work.
<ListBox Name="MyListBox">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=TextField}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
What is the proper way to do that?
Solved: TextField of My Object's class wasn't a property