Wednesday, October 24, 2007

CheckBox header column for DatagridView

It is very common to have a list of items in DataGridView with a check box in the first column where your later action will depend on user selection. This can be very easy done having a first column defined as DataGridViewCheckBoxCell object. But, how can your customer select all items in the list (let's say you are working on an email client app and user wants to delete all of his 100 spams)?
Unfortunately, .NET framework does not have a header class similar to DataGridViewCheckBoxColumn. Such a problem lead us to the idea to generate a class which will have a check box item in header where developer can have a full control after user check/uncheck item in the header. Common action is to check/uncheck all items in the DataGridView depending if header is checked/unchecked.
Whole article and class definition is available at

No comments: