Skip to main content

CustomSummaryEventArgs.SummaryProcess Property

Gets a value that indicates the data summary calculation stage.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

Declaration

public DataSummaryProcess SummaryProcess { get; }

Property Value

Type Description
DataSummaryProcess

The data summary calculation stage.

Available values:

Name Description
Start

Indicates that the process of custom summary calculation is about to be started.

Calculate

Indicates that custom summary calculation is in progress. This means the event is raised for a specific data row that contains the field value used to calculate the processed custom summary.

Finalize

Indicates that the process of custom summary calculation is finished.

Remarks

The process of custom summary calculation consists of three stages.

Initialization
The SummaryProcess property is set to CustomSummaryProcess.Start and the DataGridView.CustomSummary event is raised once.
Calculation
The SummaryProcess property is set to CustomSummaryProcess.Calculate and the DataGridView.CustomSummary event occurs multiple times, once for each data row in the grid or group.
Finalization
The SummaryProcess property is set to CustomSummaryProcess.Finalize and the DataGridView.CustomSummary event is raised once.

Example

This example uses predefined aggregate functions and custom rule to calculate group and total summaries for grid columns.

Data Summaries

  • Set the group summary to display the maximum Total value for each group of records.
  • Set the total summary to calculate the sum of values in the Total column.
  • Set the custom total summary to count the number of orders whose value in the Shipped column is false (to count orders that are not shipped).
<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Orders}" 
                 CustomSummary="OnCalculateCustomSummary">
    <!-- ... -->
    <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;
// ...

void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) {
    if (e.FieldName.ToString () == "Shipped")
        if (e.IsTotalSummary){
            if (e.SummaryProcess == CustomSummaryProcess.Start) {
                count = 0;
            }
            if (e.SummaryProcess == CustomSummaryProcess.Calculate) {
                if (!(bool)e.FieldValue)
                    count++;
                e.TotalValue = count;
            }
        }
}
See Also