Reputation: 1453
I have a datagrid with databinding to a class with several properties. I would need to bind the selected row values to several combobox or textbox when I can alter the values (2 way binding so). Imagine that the datagrid have list of Person with properties like Age and Name associated with 2 combobox where I can choose the values.
How can I make this binding of the selected value properties to the comboboxs?
Thanks in advance!
edit: I would prefer to this in the xaml if possible
Upvotes: 0
Views: 2726
Reputation: 1584
On the datagrid you need to specify the name of the control by using Name property.
<DataGrid Name= "dgPersons"/>
On the combobox you can refer the datagrid to bind the selected value.
<ComboBox SelectedValue="{Binding ElementName=dgPerosn,Path=SelectedItem.PersonId,Mode=TwoWay}/>
Upvotes: 2