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
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>
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:
How does the basic grouping work.
How to define grouping using GroupDescriptors in both XAML and code-behind.
How to configure Grouping Modes.
How to use the exposed grouping events.
How to disable the default grouping per column or for the whole RadGridView control.
How to modify the group panel.
How to group your data by multiple-columns.
How to style the group rows.
How to define aggregate functions to the group rows.
How to use the group footers.