1

I have seen many examples on how to bind in xaml to a indexed property like sugested here. And it is easy to create a binding in code like this, really straight forward, but what about binding in code to a indexed property? Cheers

Community
  • 1
  • 1

1 Answers1

1

The same exact way:

  Binding myBinding = new Binding("Contacts[John].PhoneNumber");
  myText.SetBinding(TextBlock.TextProperty, myBinding);

The Path you use doesn't change between setting in XAML and setting in Code-Behind.

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117