Suppose I have a business object 'obj1
' that has property 'P
'.
Let's also assume that I have a list of business objects: 'List<BussObj> list
' and each BussObj object contains 2 properties: 'A
' and 'B
'.
This list is bound to combobox: combobox.ItemsSource = list;
.
I would like to specify binding (in C# code) that would bind combobox.SelectedItem.B to my obj.P. How to do it?
I tried something like that but it does not work:
Binding bind= new Binding("B");
bind.Source = obj.P;
comboSubject.SetBinding(ComboBox.SelectedItemProperty, bind);
Thank you in advance for any help