Back to Devexpress

CustomSummaryEventArgs Class

maui-devexpress-dot-maui-dot-datagrid-4b22f33d.md

latest3.2 KB
Original Source

CustomSummaryEventArgs Class

Provides data for the DataGridView.CustomSummary event.

Namespace : DevExpress.Maui.DataGrid

Assembly : DevExpress.Maui.DataGrid.dll

NuGet Package : DevExpress.Maui.DataGrid

Declaration

csharp
public class CustomSummaryEventArgs :
    EventArgs

CustomSummaryEventArgs is the data class for the following events:

Remarks

The CustomSummaryEventArgs objects are automatically created, initialized and passed to the DataGridView.CustomSummary event handlers.

Example

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

  • 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 have not shipped).

  • XAML

xaml
<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>
csharp
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;
            }
        }
}

Inheritance

System.Object EventArgs CustomSummaryEventArgs

Extension Methods

Yield<CustomSummaryEventArgs>()

YieldIfNotNull<CustomSummaryEventArgs>()

See Also

CustomSummaryEventArgs Members

DevExpress.Maui.DataGrid Namespace