New to Telerik UI for WPF? Download free 30-day trial

Selection via CheckBox

The RadGridView's API offers you a GridViewSelectColumn, with the help of which you can perform a selection via CheckBox. The purpose of this tutorial is to show you how to achieve this behavior.

Here is a RadGridView declaration, which is populated with some sample data.

<telerik:RadGridView x:Name="radGridView" 
                 IsReadOnly="False" 
                 AutoGenerateColumns="False"> 
    <telerik:RadGridView.Columns> 
        <telerik:GridViewSelectColumn /> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" 
                                Header="ID"/> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding OrderNO, Mode=TwoWay}" 
                                Header="Order No"> 
        </telerik:GridViewDataColumn> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding OrderDate, Mode=TwoWay}" 
                                Header="Order Date"> 
        </telerik:GridViewDataColumn> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Country, Mode=TwoWay}" 
                                Header="Country"> 
        </telerik:GridViewDataColumn> 
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Shipped, Mode=TwoWay}" 
                                Header="Shipped?"> 
        </telerik:GridViewDataColumn> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 
The grid is shown on the next figure.

Telerik WPF DataGrid HowTo SelectionViaCheckbox 010

In order to enable the selection via checkbox behavior, you need to perform the following instructions:

  1. Enable multiple selection for the RadGridView.

<telerik:RadGridView SelectionMode="Extended"> 
2. Add an additional GridViewColumn of type GridViewSelectColumn.

<telerik:RadGridView.Columns> 
    <telerik:GridViewSelectColumn/> 
    <!--...--> 
</telerik:RadGridView.Columns> 
</telerik:RadGridView> 
Here is the final result. When you select the CheckBox Header, then all rows will be automatically selected.

Telerik WPF DataGrid HowTo SelectionViaCheckbox 020

When you want to use selection via checkbox, then:1. Set the SelectionMode property to Extended or Multiple. Leaving it to Single you won't be able to select all of the entries in the RadGridView.2. Add a GridViewSelectColumn.

If you need further information for the GridViewSelectColumn and all other provided columns take a look at the this topic.

In this article