Reputation: 12283
I want to make a binding to a specific element in the Collection. But I cannot figure out how to write the Binding. This is the code:
public class MySource
{
..
public string SomeProp;
public ICollection<T> MyCollection;
..
}
this.DataContext = new MySource();
<TextBox Text={Binding SomeProp} />
<TextBox Text={Binding FIRST_ELEMENT_OF_THE_MyCollection} />
<TextBox Text={Binding SECOND_ELEMENT_OF_THE_MyCollection} />
<!--Ignore other elements-->
Try to replace those binding strings, please
Thank you
Upvotes: 0
Views: 2393
Reputation: 12934
<TextBox Text="{Binding MyCollection[0]}" />
<TextBox Text="{Binding MyCollection[1]}" />
Upvotes: 1