GridColumnSummary.Type Property
Gets or sets the aggregation function type. This is a bindable property.
Namespace: DevExpress.Mobile.DataGrid
Assembly: DevExpress.Mobile.Grid.v18.2.dll
#Declaration
[XtraSerializableProperty]
public SummaryType Type { get; set; }
#Property Value
Type | Description |
---|---|
Summary |
A Summary |
Available values:
Name | Description |
---|---|
None | Disables summary value calculation. |
Sum | The sum of all values in a column. |
Min | The minimum value in a column. |
Max | The maximum value in a column. |
Count | The count of records. |
Average | The average value of a column. |
Custom | Specifies whether calculations should be performed manually using a specially designed event. |
#Remarks
Important
This documentation topic describes legacy technology. We no longer develop new functionality for the Grid
Use the Type property to specify which aggregate function should be used to calculate the summary value. There are five predefined aggregate functions for grid data summaries: Sum, Min, Max, Average and Count. To implement your own aggregate function, set the Type property to SummaryType.Custom and handle the GridControl.CalculateCustomSummary event.
#Example
This example shows how to calculate group and total summaries for grid columns using predefined aggregate functions or a custom rule.
The following data summaries are created.
- Group summary to display the maximum value in a Total column for each group of records.
- Total summary to calculate the sum of values by the whole Total column.
- Custom total summary to count the number of rows whose value in the Shipped column is false.
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;
}
}
}