How to update a DataGrid column when another column is changed in the same row
1 answer
Do all your manipulations in the ViewModel. Create a property for the combination Bind selectedItem, you can bind this property in the next column.
<DataGrid ItemsSource="{Binding ViewModel.Rows}" >
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding ViewModel.ComboBoxItems}" SelectedItem="{Binding ViewModel.ComboBoxSelectedItem}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding ViewModel.ComboBoxSelectedItem.Name}" />
+3
source to share