0

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

theSpyCry
  • 12,073
  • 28
  • 96
  • 152

1 Answers1

1
<TextBox Text="{Binding MyCollection[0]}" /> 
<TextBox Text="{Binding MyCollection[1]}" />
Amsakanna
  • 12,254
  • 8
  • 46
  • 58