GridControl.TotalSummaries Property
Provides access to a collection of total summary items.
Namespace: DevExpress.Mobile.DataGrid
Assembly: DevExpress.Mobile.Grid.v18.2.dll
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Collection, true, false, true)]
public ObservableCollection<GridColumnSummary> TotalSummaries { get; }
Property Value
Type | Description |
---|---|
ObservableCollection<GridColumnSummary> | A collection of total summary items. |
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.
A total summary is an aggregate function value calculated over all rows in the specified column. Total summaries are displayed at the bottom of the grid within the total summary panel, whose visibility is controlled by the GridControl.TotalSummaryVisibility property. Total summary items are specified by the GridColumnSummary objects, and are stored within the TotalSummaries collection. This collection provides methods and properties allowing you to add, remove and access summary items.
Group summaries can be accessed using the GridControl.GroupSummaries property.
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;
}
}
}