I have a Windows form with two wingrids. The first wingrid displays a hierarchy - parent band consists of box(s) and the child band consists of files in those boxes. The second wingrid displays a "flat" (no hierarchy) list of records. In the first grid, I display a "Select" checkbox in the box rows. In the second grid, I display a "Select" checkbox in each row. What is the proper way to determine if the user actually clicked the "Select" checkbox (in either grid)? I am trying to use the Grid_Click event and am getting a Nullreference exception if I click the Expansion Indicator, for example. I need a way to grab the clickable cell/item within the grid and decipher if it's the specific "Select" checkbox cell in the row. I seem to also have some undesirable behavior, since my first row in the grids are "selected"/active, even if I click the Expansion Indicator, the row becomes "selected" which is not what I want. I want the user to actually click the "Select" checkbox.
Thank you,
Chris
Hi Chris,
Use the CellChange event of the grid. But note that you cannot use the cell's Value in this event, because the Value will not be updated until you leave the cell. So you have to use the Text property of the cell and convert the string to a boolean. You can use Boolean.Parse to make this easy.
Mike,
I came across another helpful post you had regarding the code in the Grid's MouseUp event. This retrieved the last UIElement to ultimately drill down and find the cell and determine if it's a CheckEditor. This worked for me. Thank you!Now on to the next thing...
Best Regards,Chris