private void dataGrid1_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { if (e.EditingElement is TextBox) { string newValue = (e.EditingElement as TextBox).Text; if (oldValue != newValue) { TruckInfo ri = e.Row.Item as TruckInfo; if (ri != null) { x_tService.UpdateRow(e.Column.SortMemberPath, newValue, ri.Id); } } } }