# .NET MAUI DataGrid Grouping

The [Telerik UI for .NET MAUI DataGrid](https://www.telerik.com/maui-ui/documentation/controls/datagrid/overview) supports grouping operations either through the UI - using the Grouping UI or programmatically through Property and Delegate group descriptors.

## Grouping UI

The DataGrid Grouping UI is enabled by design on desktop and disabled on mobile, it allows the user to group the DataGrid by dragging and dropping the column headers to the `DataGridGroupingPanel`.

The UI is represented by the `DataGridGroupingPanel`. The panel is part of the DataGrid and it's visualized at the top.

> caption Grouping UI in the .NET MAUI DataGrid

![.NET MAUI DataGrid grouping UI showing drag-and-drop grouping in the grouping panel](https://www.telerik.com/maui-ui/documentation/assets/98ab10b62e5d0d269f7511863d903598/datagrid-grouping-ui.gif)

> For more information about Grouping UI review the [Grouping UI](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/grouping-ui) article of the DataGrid.

Customize the appearance of the items inside the grouping panel by using the `GroupingPanelItemTemplate` (`DataTemplate`) property.

## Programmatic Grouping

Programmatic grouping can be done by adding descriptors to the `GroupDescriptors` collection. There are two types of descriptors:

* `PropertyGroupDescriptor`—Uses a property from the model as a group key.
* `DelegateGroupDescriptor`—Creates a custom group key which you can use.

## Expand and Collapse Groups

The [Telerik UI for .NET MAUI DataGrid](https://www.telerik.com/maui-ui/documentation/controls/datagrid/overview) lets you expand and collapse a group either through the UI—by tapping on the group headers—or programmatically.

The DataGrid allows you to collapse all groups and newly added groups by setting the `AutoExpandGroups` (`bool`) property. The default value of the `AutoExpandGroups` property is `true`, which means, all groups are expanded by default.

## Group Headers Customization

The DataGrid provides the ability to fully customize its group headers in order to achieve the desired look when the data is grouped. Go to [Group Header Template](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/group-header-template) topic for detailed information on this.

> tip For an outline of all DataGrid features review the [.NET MAUI DataGrid Overview](https://www.telerik.com/maui-ui/documentation/controls/datagrid/overview) article.

## See Also

* [Grouping UI](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/grouping-ui)
* [Property Group Descriptor](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/property-group-descriptor)
* [Delegate Group Descriptor](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/delegate-group-descriptor)
* [Group Header Template](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/group-header-template)
* [Group Header Styling](https://www.telerik.com/maui-ui/documentation/controls/datagrid/theming-and-styles/group-header-styling)
