# Multiple-Column Grouping

On the snapshot you can see how the data in the **RadGridView** is grouped by two columns - the **Country** and the **Title**. The data is first grouped by the **Country** column and then the data in the separate groups is grouped again by the **Title** column.

![Telerik UI for WPF RadGridView grouped first by Country and then by Title](https://www.telerik.com/products/wpf/documentation/assets/ab6d2aae16c95f01eb183fd6b92981a8/radgridview_multicolumngrouping_1.png)

The user can do it via the built-in grouping mechanism by dragging and dropping more than one column headers into the grouping area.

![Telerik UI for WPF RadGridView dragging multiple column headers into the group panel](https://www.telerik.com/products/wpf/documentation/assets/86b9f69ee37c781ce163b356a95bf010/radgridview_multicolumngrouping_2.png)

> The data in the **RadGridView** will be grouped depending on the order the user drops the headers in the grouping area.

After adding several headers you are allowed to reorder them by dragging the rectangle representing the grouping criteria and dropping it at the desired position.

![Telerik UI for WPF RadGridView reordering multiple grouping criteria in the group panel](https://www.telerik.com/products/wpf/documentation/assets/d4891d4792e7da70393fba6724951e1c/radgridview_multicolumngrouping_3.png)

It is also possible to group the data by multiple columns programmatically by using the **GroupDescriptors** collection of **RadGridView**. To learn more about it take a look at the [Programmatic Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/programmatic-grouping) topic.

If you want to implement multi-column grouping you just have to define **GroupDescriptor** or **ColumnGroupDescriptor** objects for the desired grouping criteria and add them to the **GroupDescriptors** collection. It can be done at design time:

```XAML
<telerik:RadGridView x:Name="radGridView"
                AutoGenerateColumns="False">
    <telerik:RadGridView.GroupDescriptors>
        <telerik:GroupDescriptor Member="Country"
                            SortDirection="Ascending" />
        <telerik:GroupDescriptor Member="Title"
                            SortDirection="Ascending" />
    </telerik:RadGridView.GroupDescriptors>
</telerik:RadGridView>
```

This can be done at run time via managed code too:

```C#
GroupDescriptor countryDescriptor = new GroupDescriptor();
countryDescriptor.Member = "Country";
countryDescriptor.SortDirection = ListSortDirection.Ascending;
this.radGridView.GroupDescriptors.Add(countryDescriptor);
GroupDescriptor titleDescriptor = new GroupDescriptor();
titleDescriptor.Member = "Title";
titleDescriptor.SortDirection = ListSortDirection.Ascending;
this.radGridView.GroupDescriptors.Add(titleDescriptor);
```

```VB.NET
Dim countryDescriptor As New GroupDescriptor()
countryDescriptor.Member = "Country"
countryDescriptor.SortDirection = ListSortDirection.Ascending
Me.radGridView.GroupDescriptors.Add(countryDescriptor)
Dim titleDescriptor As New GroupDescriptor()
titleDescriptor.Member = "Title"
titleDescriptor.SortDirection = ListSortDirection.Ascending
Me.radGridView.GroupDescriptors.Add(titleDescriptor)
```

The result is the same as if the user has dragged and dropped the desired columns into the grouping area:

![Telerik UI for WPF RadGridView showing the result of programmatic multi-column grouping by Country and Title](https://www.telerik.com/products/wpf/documentation/assets/ab6d2aae16c95f01eb183fd6b92981a8/radgridview_multicolumngrouping_1.png)

## See Also

* [Basic Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/basics)

* [Programmatic Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/programmatic-grouping)

* [Group Aggregates](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/aggregates)

* [Group Footers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/group-footers)

* [Modifying the Group Panel](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/modifying-group-panel)
