I have a DataGridView that’s bound to a list of POCO objects. One of the POCO properties is a bool, that’s represented by a checkbox. What I’d like is to be able to select multiple rows, then when I click one of the checkboxes, all the highlighted rows have their check boxes checked. By way of example, if you’re using TFS under VS 2010, I’m trying to replicate the behaviour on the Pending Changes screen.
My problem is that I can’t find a suitable event to listen to. Most DataGridView click events seem to operate at the Column/Row level, and I want something that fires when you click the checkbox. CellContentClick comes the closest, but that fires after the rows have been unselected, so that’s not going to work.
Does anyone have any suggestions?
You can use CurrentCellDirtyStateChanged for when Checkbox value has changed. But when this event triggers, the selectedrows will be gone. All you should do is to save selectedrows before it.
A simple sample: you can complete it easily.