RadControls for WPF

The 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 the RadGridView is not grouped, the GridViewGroupPanel shows a customizable hint.

 

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

CopyXAML
<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:

CopyC#
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
CopyVB.NET
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
Note

Note that since GroupDescriptors property is a collection, you can add more than one GroupDescriptor to a RadGridView.

Tip
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