Domanda

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?

È stato utile?

Soluzione

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;
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top