开发者

DataGridView CheckboxColumn header check box synchronize with rows?

开发者 https://www.devze.com 2023-03-25 03:16 出处:网络
I have made a checkbox inside the header of checkbox column. It works fine when i check it all rows in the DataGridView gets checked. What I want to do is to uncheked the header cell checkbox when a s

I have made a checkbox inside the header of checkbox column. It works fine when i check it all rows in the DataGridView gets checked. What I want to do is to uncheked the header cell checkbox when a single row in the DataGridView is unchecked. I tried putting code in the CellValueChanged event that sets the header checkbox state. The problem is that CellValueChanged is fired when current cell loses focus. So if I click two or 开发者_运维技巧three times in the cell nothing happens, but when e select next cell the event is fired and the header cell checkbox state is invalidated.


In CurrentCellDirtyStateChanged event call the datagridview's CommitEdit(DataGridViewErrorContexts.Commit) method. It commits the cell value and triggers the CellValueChanged event of corresponding cell.


tried CurrentCellDirtyStateChanged event?

0

精彩评论

暂无评论...
验证码 换一张
取 消