Home Forums WinForms controls Xceed Grid for WinForms cannot raise keydown events in DataGrid Reply To: cannot raise keydown events in DataGrid

User (Old forums)
Member
Post count: 23064

You need to subscribe to the cell editor, and not the column. Use the ActivatingControl event to accomplish this :

In form load before loading the data :

gridControl1.Columns[ 1 ].CellEditorManager.ActivatingControl += new CellEditorEventHandler(CellEditorManager_ActivatingControl);

gridControl1.Columns[ 1 ].CellEditorManager.DeactivatingControl += new CellEditorEventHandler(CellEditorManager_DeactivatingControl);

Events :

private void CellEditorManager_ActivatingControl(object sender, CellEditorEventArgs e)
{
( ( Xceed.Editors.WinTextBox )e.Control).TextBoxArea.KeyUp += new KeyEventHandler(TextBoxArea_KeyUp);
}

private void CellEditorManager_DeactivatingControl(object sender, CellEditorEventArgs e)
{
( ( Xceed.Editors.WinTextBox )e.Control).TextBoxArea.KeyUp -= new KeyEventHandler(TextBoxArea_KeyUp);
}

private void TextBoxArea_KeyUp(object sender, KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine( “in editor KeyUp” );
}

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