public void ToggleMode(GridCell gridCell) { VerifyGridCell(gridCell, nameof(gridCell)); bool isKeyboardFocusWithin = gridCell.IsKeyboardFocusWithin; var mode = Mode; Mode = mode == GridCellMode.Edit ? GridCellMode.Select : GridCellMode.Edit; gridCell.Refresh(); if (isKeyboardFocusWithin && !gridCell.ContainsKeyboardFocus()) { gridCell.Focus(); } }