This project is read-only.

CheckBox question

Jan 12, 2011 at 8:33 PM


I'm trying to capture an event when CheckBox checked or unchecked manually. I was able to successfully capture other cells being edited by implementing a custom controller that overrides OnEditEnded event. It works well for regular cells with double values, however for CheckBox (with bool) it captures the event, however checkbox never changes its value - i.e. stays checked or unchecked. Any thoughts on how to fix this, or a  work-around?

Here is the relevant code 


grid1[1, 0] = new SourceGrid.Cells.CheckBox(); 

grid1[1, 0].Editor = SourceGrid.Cells.Editors.Factory.Create(typeof(bool));


grid1[1, 7] = new SourceGrid.Cells.Cell();

 grid1[1, 7].Editor = SourceGrid.Cells.Editors.Factory.Create(typeof(double));


grid1.Controller.AddController(new MyController( ... ));


    public class MyController : SourceGrid.Cells.Controllers.ControllerBase  

        public MyController(List<DHedgeItem> _hedgeItems, SourceGrid.Grid _grid1)        {          ...       }
        public override void OnEditEnded(SourceGrid.CellContext sender, EventArgs e)    


 base.OnEditEnded(sender, e);

.... changing bool or double triggers this event, but CheckBox value does not change




Jan 13, 2011 at 7:33 AM

Through the Editor you can get the Control object that is used for edit. That object will be CheckBox, so you can cast it to this type. And then you can attach to "check box value changed" event to capture what you need

Jan 20, 2011 at 3:00 PM

Can you please provide a code example - I tried but could not implement what you wrote in your post.

Thank you! 

Jan 20, 2011 at 3:37 PM

See frmSample03.cs line 436, that should help

Jan 20, 2011 at 6:36 PM
Edited Jan 20, 2011 at 6:37 PM

Sorry wrong post.