# .NET MAUI DataGrid Aggregates

The DataGrid exposes an Aggregates API through its `DataGridColumn.AggregateDescriptors` collection, where you can add `PropertyAggregateDescriptor` and `DelegateAggregateDescriptor`.

<CtaPanelMauiOverview></CtaPanelMauiOverview>

## Aggregate Descriptors

The [`PropertyAggregateDescriptor`](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/property-aggregate-descriptor) enables you to use a set of available functions while the [`DelegateAggregateDescriptor`](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/delegate-aggregate-descriptor) allows you to implement a custom function through the `IAggregateFunction` interface.

## Aggregates Visualization

You can visualize the aggregates inside the:

* [DataGrid Column Footer](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/overview#aggregates-in-column-footer) through the `ShowColumnFooters` property.
* [DataGrid Group Header](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/overview#aggregates-in-group-header) through the `ShowGroupHeaderAggregates` property.
* [DataGrid Group Footer](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/overview#aggregates-in-group-footer) through the `ShowGroupFooters` property.

In all cases, the visualization options only control where the results appear. The results themselves are calculated only for columns whose `DataGridColumn.AggregateDescriptors` collection is populated, so always add the descriptors to the target column first.

### Aggregates in Column Footer

Once the `AggregateDescriptors` collection of a column is populated, use the `ShowColumnFooters` property to visualize the [`ColumnFooters`](https://www.telerik.com/maui-ui/documentation/controls/datagrid/columns/footer) of the DataGrid and display the aggregate results of that column inside its footer.

> The aggregate results are displayed inside the column footer only if there is no `FooterText` set.

> caption .NET MAUI DataGrid aggregates displayed in the column footer

![.NET MAUI DataGrid column footer showing aggregate results on Windows](https://www.telerik.com/maui-ui/documentation/assets/7357c541002ca3029a123256982a323f/datagrid-property-aggregate-windows.png)

### Aggregates in Group Header

When [grouping](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/overview) is applied to the DataGrid, the columns with populated `AggregateDescriptors` collection can display the aggregate results for the groups data in the group header, next to the title of the group.

To show the Aggregates in the group header, set the `ShowGroupHeaderAggregates` to `True`.

> caption .NET MAUI DataGrid aggregates displayed in the group header

![.NET MAUI DataGrid group header showing aggregate results for grouped data](https://www.telerik.com/maui-ui/documentation/assets/83bb2575ea4ac9ddf437d94cbac53ec8/datagrid-group-header-aggregate.png)

To align the aggregates in the group according to its header, set the `GroupAggregatesAlignment` (`enum` of type `Telerik.Maui.Controls.DataGrid.DataGridGroupAggregatesAlignment`) property. The available options are:

* (default)`None`—Aggregates are not aligned to the DataGrid columns. The aggregates results are displayed after the text displayed for the group key.
* `NextToHeader`—Aggregate results are aligned to the DataGrid columns and placed next to the header of the group.

### Aggregates in Group Footer

When [grouping](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/overview) is applied to the DataGrid, the columns with populated `AggregateDescriptors` collection can display the aggregate results for the groups data in the group footer.

To visualize the group footer, set the `ShowGroupFooters` property to `True`. The group footer is divided into cells which are aligned with the respective columns and show the aggregate results for the particular column.

> caption .NET MAUI DataGrid aggregates displayed in the group footer

![.NET MAUI DataGrid group footer showing aggregate results for grouped data](https://www.telerik.com/maui-ui/documentation/assets/bf924a8bf6e2ab03a88bf143e6bfb263/datagrid-group-footer-aggregate.png)

> 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

* [Property Aggregate Descriptor](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/property-aggregate-descriptor)
* [Delegate Aggregate Descriptor](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/delegate-aggregate-descriptor)
