Frage

I'm trying to make the behaviour of the Enter key in a Syncfusion grid match Excel's behaviour.

I'm able to control the behaviour of the enter key by setting

    grid.Model.Options.EnterKeyBehavior = GridDirectionType.Down

but I'm struggling to make Shift+Enter make the cell selection move upwards.

Does anyone know how this is done?

War es hilfreich?

Lösung

You can handle the KeyDown event on the GridControl, check the keys pressed and move the current cell up.

void Grid_KeyDown(object sender, KeyEventArgs e)
{
    if ((e.KeyCode & Keys.Enter) == Keys.Enter && e.Modifiers == Keys.Shift)
    {
        grid.CurrentCell.Move(GridDirectionType.Up, 1, false);
        e.Handled = true;
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top