I have DataGrid and its itemsource is a list of object which is named WeightItemData.
My all columns in data grid are DataGridTextColumn except one that is DataGridTemplateColumn and it is a Combobox.
My problem is that i cannot get the updated combox value inside the DataGridCellEditEnding method.
<DataGridTemplateColumn Header="Crew" SortMemberPath="FsmTypes">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FsmType}"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding FsmTypes, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding FsmType,Mode=TwoWay}"></ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
private void DataGridCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
TextBlock cmb = e.EditingElement as TextBlock;
if (e.EditAction == DataGridEditAction.Commit)
{
WeightItemData wid = e.Row.DataContext as WeightItemData;
}
}