Home Forums WinForms controls Xceed Grid for WinForms help with InsertionRow Reply To: help with InsertionRow

User (Old forums)
Member
Post count: 23064

You can use the QueryInputKey event on the CellEditorManager, and monitor which key is pressed, an act accordingly.  Note that the up or down arrow should already commit the changes to the InsertionRow.

e.g. :

private void Form1_Load(object sender, EventArgs e)

{

    foreach( Column col in gridControl1.Columns )

    {

        col.CellEditorManager.QueryInputKey += new QueryEditorInputKeyEventHandler(CellEditorManager_QueryInputKey);

    }

}

void CellEditorManager_QueryInputKey( object sender, QueryEditorInputKeyEventArgs e )

{

    if( e.Cell.GetType() == typeof( InsertionCell ) )

    {

        //if you want “Enter” on the last cell to commit the insertion data, then do nothing in that case.

        if( e.KeyData == Keys.Enter && e.Cell.ParentColumn.Title != LastCell )

        {

            gridControl1.MoveCurrentCell(

HorizontalDirection.Right );

            e.IsInputKey =

true;

        }

    }

}

Imported from legacy forums. Posted by André (had 315 views)