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

Grouping

RadGridView provides you with a built-in grouping functionality, which allows the user to easily group the data by one or more columns. To do so the user has to just drag the desired column to the GridViewGroupPanel, located at the top of the RadGridView. If RadGridView is not grouped, the GridViewGroupPanel shows a customizable hint.

Figure 1: Grouped RadGridView

Telerik WPF DataGrid Functional Overview Grouping 1

You can define grouping either in the XAML or in the code-behind.

Example 1: Grouping applied through XAML

<telerik:RadGridView x:Name="radGridView" 
                AutoGenerateColumns="False"> 
    <telerik:RadGridView.GroupDescriptors> 
        <telerik:GroupDescriptor Member="Country" 
                            SortDirection="Ascending" /> 
        <!--You can add more group descriptors here--> 
    </telerik:RadGridView.GroupDescriptors> 
</telerik:RadGridView> 
You can achieve the same result if you define your grouping in the code-behind like this:

Example 1: Grouping applied programmatically

GroupDescriptor descriptor = new GroupDescriptor(); 
descriptor.Member = "Country"; 
descriptor.SortDirection = ListSortDirection.Ascending; 
descriptor.DisplayContent = "Country Group"; 
this.radGridView.GroupDescriptors.Add(descriptor); 
//You can create and add more descriptors here 
Dim descriptor As New GroupDescriptor() 
descriptor.Member = "Country" 
descriptor.SortDirection = ListSortDirection.Ascending 
descriptor.DisplayContent = "Country Group" 
Me.radGridView.GroupDescriptors.Add(descriptor) 
'You can create and add more descriptors here 

Тhe GroupDescriptors property of RadGridView is a collection so you can add more than one GroupDescriptor to a certain RadGridView.

Consider using the code-behind approach only when changing the grouping criteria run-time.

Check out the chapters entirely dedicated to the grouping functionality of RadGridView and find the answers to the following questions:

See Also

In this article