newDatagrid.EditTrigger = EditTrigger.OnTap; //newDatagrid.CellStyleSelector = new CellStyleSelector(); newDatagrid.CurrentCellEndEdit += newDatagrid_CurrentCellEndEdit;
private void newDatagrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs args) { var grid = sender as SfDataGrid; var cell = (grid.SelectionController.CurrentCellManager.CurrentCell.Renderer as GridCellRendererBase).CurrentCellElement; if (cell != null) { grid.UpdateDataRow(args.RowColumnIndex.RowIndex); } }
private void DataGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs e)
{
System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
{
var grid = sender as SfDataGrid;
//getting GridCell
var cell = (grid.SelectionController.CurrentCellManager.CurrentCell.Renderer as GridCellRendererBase).CurrentCellElement;
if (cell != null)
{
var vm = cell.DataContext as OrderInfo;
//assigned columnindex to the index property in OrderInfo
vm.DataIndex = e.RowColumnIndex.ColumnIndex;
// updates the current row index
grid.UpdateDataRow(e.RowColumnIndex.RowIndex);
}
}), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
} |