grid.CurrentCellPreviewKeyDown += grid_CurrentCellPreviewKeyDown;
void grid_CurrentCellPreviewKeyDown(object sender, GridCellKeyEventArgs args)
{
if(args.Key == Key.Down || args.Key == Key.Up || args.Key == Key.Left || args.Key == Key.Right)
args.Cancel = true;
} |
//Event subscription
grid.CurrentCellPreviewKeyDown += grid_CurrentCellPreviewKeyDown;
//Event customization
private void grid_CurrentCellPreviewKeyDown(object sender, GridCellKeyEventArgs args)
{
GridCurrentCell currentCell = grid.CurrentCell;
if (grid.Model[currentCell.RowIndex, currentCell.ColumnIndex].CellType == "IntegerEdit" &&
(args.Key == Key.Down || args.Key == Key.Up || args.Key == Key.Left || args.Key == Key.Right))
{
args.Cancel = true;
//To Move current cell as per other cells arrow key behavior.
grid.MoveCurrentCellWithArrowKey(args.KeyEventArgs); //NOTE: this can be added only if needed.
}
} |