Reputation: 121
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
Upvotes: 1
Views: 830
Reputation: 61349
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.
Upvotes: 1