Good Evening,
i have a simple Problem:
I know that I can bind objects in Context of Data like this:
//Class CustomObject with a Property named "Property" with value "obj1"
CustomObject obj1 = new CustomObject("obj1");
DataContext = obj1;
<TextBox Text="{Binding Property}"
This works. But what is when I ve more than one object of a class. I tried something like this:
<TextBox Text="{Binding obj1.Property}"
Unfortunatly it doesnt work. Know anyone how I can bind by object Name?
Thanks.
Edit: In C# its working with this Code:
CustomObject obj1 = new CustomObject("Test");
Binding myBinding = new Binding();
myBinding.Path = new PropertyPath("Property");
myBinding.Source = obj1;
textBox1.SetBinding(TextBox.TextProperty, myBinding);
So I tried the same in XAML, unfortunatly not sucessfully:
<TextBox Text="{Binding Property, Source=Obj1}"/>