The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridControl.CalculateCustomSummary Event

Allows you to calculate summary values manually.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll

Declaration

public event CustomSummaryEventHandler CalculateCustomSummary
Public Event CalculateCustomSummary As CustomSummaryEventHandler

Event Data

The CalculateCustomSummary event handler receives an argument of the CustomSummaryEventArgs type. The following properties provide information specific to this event.

Property Description
FieldName Gets the processed field name.
FieldValue Gets the processed field value.
GroupRowHandle Gets a value identifying the group row whose child data rows are involved in summary calculation.
IsGroupSummary Gets whether a group summary value is being calculated.
IsTotalSummary Gets whether a total summary value is being calculated.
Row Gets an object that contains information on the currently processed row.
SummaryProcess Gets a value indicating the data summary calculation stage.
TotalValue Gets or sets the total summary value.
TotalValueReady Gets or sets whether the Calculation stage of the custom summary calculation process should be skipped.

Remarks

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

Total and group summaries provide five predefined aggregate functions (Count, Max, Min, Sum and Average). To calculate a summary value using a custom rule, set the summary item's GridColumnSummary.Type property to SummaryType.Custom, and handle the CalculateCustomSummary event.

The CalculateCustomSummary event fires for each data row involved in summary calculation. When calculating a total summary value, the event is raised for each data row. When calculating a group summary value, this event fires for each data row within a group. To enable you to perform any initialization and finalization, the event is also raised before and after processing rows.

The summary calculation consists of the three stages.

To skip the Calculation stage and calculate a custom summary at the Initialization or Finalization stage, set the event parameter's CustomSummaryEventArgs.TotalValueReady property to true at the Initialization stage. This automatically skips the Calculation stage and the Finalization stage starts immediately.

Examples

This example shows how to use the GridControl.CalculateCustomSummary event to create a custom summary that counts the total number of data rows whose cells in the Shipped column (SwitchColumn) contain false.

<dxGrid:GridControl.TotalSummaries>
    <dxGrid:GridColumnSummary FieldName="Total" Type="Sum" 
                            DisplayFormat= "Total: {0:C0}"/>
    <dxGrid:GridColumnSummary FieldName="Shipped" Type="Custom" 
                            DisplayFormat= "Not Shipped: {0}"/>
</dxGrid:GridControl.TotalSummaries>
See Also