/// <summary> /// This event handler demonstrates how to handle the QueryNextCurrentCellPosition /// event in order to skip not only disabled cells but also skip readonly cells. /// </summary> /// <param name="e">Event data.</param> protected override void OnQueryNextCurrentCellPosition(GridQueryNextCurrentCellPositionEventArgs e) { // just set this flag true if you want to try out this event handler. bool flag = false; if (flag) { int rowIndex = e.RowIndex; int colIndex = e.ColIndex; e.Handled = true; bool enabledCellFound = true; while (enabledCellFound) { enabledCellFound = CurrentCell.QueryNextEnabledCell(e.Direction, ref rowIndex, ref colIndex); if (enabledCellFound) { if (!this[rowIndex, colIndex].ReadOnly) { break; } switch (e.Direction) { case GridDirectionType.Left: colIndex--; break; case GridDirectionType.Right: colIndex++; break; case GridDirectionType.Up: rowIndex--; break; case GridDirectionType.Down: rowIndex++; break; default: enabledCellFound = false; break; } } } if (enabledCellFound) { e.RowIndex = rowIndex; e.ColIndex = colIndex; } e.Result = enabledCellFound; } base.OnQueryNextCurrentCellPosition(e); }