CheckBox Column

GridViewCheckBoxColumn derives from GridViewBoundColumnBase class and its content is represented by a CheckBox for each row. The difference between it and GridViewSelectColumn is that this one is meant to be bound. As opposed, GridViewSelectColumn allows you to select the row through the CheckBox that it utilizes.

Example 1: Declare a column of type GridViewCheckBoxColumn

<telerik:RadGridView x:Name="radGridView" 
                AutoGenerateColumns="False" 
                ItemsSource="{Binding Items}"> 
    <telerik:RadGridView.Columns> 
        <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsActive}" /> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 

Figure 1: Declared CheckBox Column.

Rad Grid View Columns Check Box Column 01

Use this column for better performance when you know that the underlying data is of boolean type.

GridViewCheckBoxColumn provides a property that is not present in any other column: AutoSelectOnEdit. When set to True the CheckBox is automatically toggled on editing the cell thus decreasing the number of clicks you need to take to change the boolean value of the bound property.

Here are the possible cases:

  1. Default (AutoSelectOnEdit="False", EditTriggers="Default") - three clicks are needed to change the value of the CheckBox - two clicks to enter the edit mode and one click to toggle the CheckBox state.

  2. AutoSelectOnEdit="True", EditTriggers="Default" - two clicks are needed to change the value of the CheckBox - the clicks to enter the edit mode.

  3. AutoSelectOnEdit="True", EditTriggers="CellClick" - only one click is needed to change the value of the CheckBox.

Example 2: Change the value of the CheckBox with one click

<telerik:RadGridView x:Name="radGridView" 
                AutoGenerateColumns="False" 
                ItemsSource="{Binding Items}"> 
    <telerik:RadGridView.Columns> 
        <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsSelected}" AutoSelectOnEdit="True" EditTriggers="CellClick"/> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 

Since the GridViewCheckBoxColumn is specially designed to dispay checkboxes, setting its CellTemplate, CellEditTemplate, CellTemplateSelector and CellEditTemplateSelector is not supported. For such requirements, you can use a GridViewDataColumn. How to style the templates is described here.

See Also

In this article