This example demonstrates how to add a check box to a column header.
Pic. 1
Pic.2
To use this solution in your application, execute the following steps:
1. Drop the GridViewColumnHeaderExtender component onto the target form.
2. Assign GridView to this component.
Description
GridViewColumnHeaderExtender provides the DrawCheckBoxByDefault property. Set this property to true to make check boxes always visible (as shown in Pic. 1). If you wish to hide these check boxes and show a check box only when the cursor is above a column, set this property to false (Pic. 2).
When a column is checked / unchecked, the GridViewColumnHeaderExtender.ColumnCheckedChanged event is raised. You can handle this event in order to notify related objects of this change. The event handler receives an argument of the ColumnCheckedChangedEventArgs type containing data related to this event.
See also:
How to add a custom button to a column header in a grid
GridView.CustomDrawColumnHeader Event