Вопрос

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?

Это было полезно?

Решение

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;
    }
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top