Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataGridView.GroupSummaries Property

Provides access to the collection of group summary items.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

C#
public SummaryCollection GroupSummaries { get; }

#Property Value

Type Description
SummaryCollection

A collection of group summary items.

#Example

The following example uses predefined aggregate functions (Max and Sum) and a custom rule to calculate group and total summaries for a grid that displays orders grouped by dates.

Data Grid Summaries - Example

Set up the following summaries:

  • A group summary to display the maximum Total value for each group of orders.
  • A total summary to calculate the sum of values in the Total column.
  • A custom total summary to count the number of orders with the false value in the Shipped column.
<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Orders}" 
                  CustomSummary="grid_CalculateCustomSummary">
    <!-- ... -->
    <dxg:DataGridView.GroupSummaries>
        <dxg:GridColumnSummary FieldName="Total" Type="Max"/>
    </dxg:DataGridView.GroupSummaries>

    <dxg:DataGridView.TotalSummaries>
        <dxg:GridColumnSummary FieldName="Total" Type="Sum" 
                               DisplayFormat="Total: {0:C0}"/>
        <dxg:GridColumnSummary FieldName="Shipped" Type="Custom" 
                               DisplayFormat="Not Shipped: {0}"/>
    </dxg:DataGridView.TotalSummaries>
</dxg:DataGridView>
int count;
// ...

private void grid_CustomSummary(object sender, DevExpress.Maui.DataGrid.CustomSummaryEventArgs e) {
    if (e.FieldName.ToString() == "Shipped")
        if (e.IsTotalSummary) {
            if (e.SummaryProcess == DevExpress.Maui.Core.DataSummaryProcess.Start) {
                count = 0;
            }
            if (e.SummaryProcess == DevExpress.Maui.Core.DataSummaryProcess.Calculate) {
                if (!(bool)e.Value)
                    count++;
                e.TotalValue = count;
            }
        }
}
See Also