Search code examples
c#infragisticsultrawingrid

Infragistics Ultragrid - do not move below row when selecting right most column


Is there any way to force Infragistics Ultragrid to do not move below row when pressing right arrow key on last column ?

eg having below table, being in cell with "C" value (COL_1, row 1) - if I press right arrow key it moves me to below row (D value), while I woudld like stay in same row, same cell (as Ive reached 'end' of row)

   COL_A | COL_B | COL_C
1    A      B        C
2    D      ...

Solution

  • The KeyDown event for the UltraGrid might be used to implement this functionality too:

    private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Right && sender is UltraGrid ug)
        {
            if ((ug.CurrentState & UltraGridState.CellLast) == UltraGridState.CellLast)
                e.Handled = true;
        }
    }