Home Forums WinForms controls Xceed Grid for WinForms Grid CheckBoxEditor Reply To: Grid CheckBoxEditor

User (Old forums)
Member
Post count: 23064

CheckBoxEditor is a template that generates cloned instances. You need to first subscribe to the ActivatingControl :

Xceed.Grid.Editors.CheckBoxEditor chkBoxEditor = new Xceed.Grid.Editors.CheckBoxEditor();

chkBoxEditor.ActivatingControl +=new Xceed.Grid.Editors.CellEditorEventHandler(chkBoxEditor_ActivatingControl);
chkBoxEditor.DeactivatingControl +=new Xceed.Grid.Editors.CellEditorEventHandler(chkBoxEditor_DeactivatingControl);

You will also want to subscribe to the deactivatingControl and unsubcribe to the events there :

private void chkBoxEditor_ActivatingControl(object sender, Xceed.Grid.Editors.CellEditorEventArgs e)
{
((Xceed.Editors.WinCheckBox)e.Control).CheckedChanged +=new EventHandler(Form1_CheckedChanged);

}

private void chkBoxEditor_DeactivatingControl(object sender, Xceed.Grid.Editors.CellEditorEventArgs e)
{

((Xceed.Editors.WinCheckBox)e.Control).CheckedChanged -=new EventHandler(Form1_CheckedChanged);

}

this will do what you need.

Imported from legacy forums. Posted by Matt (had 505 views)