Skip to main content
A newer version of this page is available. .

DataGridView.CalculateCustomSummary Event

Allows you to specify a custom rule to calculate data summaries.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

Declaration

public event CustomSummaryEventHandler CalculateCustomSummary

Event Data

The CalculateCustomSummary event's data class is CustomSummaryEventArgs. The following properties provide information specific to this event:

Property
FieldName
FieldValue
GroupRowHandle
IsGroupSummary
IsTotalSummary
Row
SummaryProcess
TotalValue
TotalValueReady

The event data class exposes the following methods:

Method
GetValue(String)

Remarks

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.

Example

This example demonstrates how to use 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}" 
                 CalculateCustomSummary="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>
See Also