GridColumnSummary Class
A data summary item.
Namespace: DevExpress.Mobile.DataGrid
Assembly: DevExpress.Mobile.Grid.v18.2.dll
Declaration
public class GridColumnSummary :
BindableObject,
IToDecimalConverter,
ICloneable,
INotifyPropertyChanged,
ICancellableReader
Related API Members
The following members return GridColumnSummary objects:
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.
The GridControl allows you to display concise information about groups of rows or individual data columns. For example, you can display the number of records, or maximum value, etc. This is called a summary.
Two summary types are supported: total summaries and group summaries. The grid stores its total summary items within the GridControl.TotalSummaries collection. Group summary items are stored within the GridControl.GroupSummaries collection. Individual summary items are represented by the GridColumnSummary class.
When specifying a data summary in the grid, use GridColumnSummary object properties to specify the field against whose values a summary should be calculated (GridColumnSummary.FieldName), the summary value format (GridColumnSummary.DisplayFormat) and the aggregate function (GridColumnSummary.Type). Note that you can calculate summaries using predefined aggregate functions (SummaryType.Count, SummaryType.Min, SummaryType.Max, SummaryType.Sum or SummaryType.Average) or your own custom rule (set the GridColumnSummary.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;
}
}
}