I need to bind the value of the SelectedItem from the datagrid to:
SelectedItem of a combo box on the same page
Property in the viewmodel
In other words: when I select a row in the datagrid the value in the combobox should change and value of the meant above property should be also set to the value of the selected item of the datagrid.
I tried to use multibinding like this:
<DataGrid.SelectedItem>
<MultiBinding Converter="{StaticResource sapConverter}" >
<Binding Path="SelectedSap" Mode="TwoWay"/>
<Binding ElementName="cbSearchCompanyName" Path="SelectedItem" Mode="OneWay"/>
</MultiBinding>
</DataGrid.SelectedItem>
the SelectedSap here is that property, that I want to update. But when I look at the values() in the converter, value(0) corresponding to the SelectedSap is always Nothing and as a result the property doesn't change as I want. The binding with the combo works fine.
I try to test it without multibinding. I mean, I don't care about the combo, I'm just changing the value of the property. Like this:
<DataGrid.SelectedItem>
<Binding Path="SelectedSap" Mode="TwoWay"/>
</DataGrid.SelectedItem>
everything works fine. Where is the trick and how should I implement the functionality I need? Thank you.