GridSummaryItem.SummaryType Property
Gets or sets the aggregation function type.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
[DefaultValue(SummaryItemType.None)]
[DXCategory("Behavior")]
[XtraSerializableProperty(1)]
public SummaryItemType SummaryType { get; set; }
Property Value
Type | Default | Description |
---|---|---|
SummaryItemType | None | A SummaryItemType enumeration value specifying the summary type. |
Available values:
Name | Description |
---|---|
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 record count. |
Average | The average value of a column. |
Custom | Specifies whether calculations should be performed manually using a specially designed event. |
None | Disables summary value calculation. |
Remarks
Use the SummaryType property to specify the type of aggregate function used to calculate the summary value. The following predefined aggregate functions are available:
- sum;
- minimum value;
- maximum value;
- average value;
- the number of records.
using DevExpress.XtraGrid;
gridView1.OptionsView.ShowFooter = true;
GridColumnSummaryItem siTotal = new GridColumnSummaryItem();
siTotal.SummaryType = SummaryItemType.Count;
siTotal.DisplayFormat = "{0} records";
colOrderID.Summary.Add(siTotal);
GridColumnSummaryItem siAverage = new GridColumnSummaryItem();
siAverage.SummaryType = SummaryItemType.Average;
siAverage.FieldName = "Freight";
siAverage.DisplayFormat = "Average: {0:#.#}";
gridView1.Columns["Freight"].Summary.Add(siAverage);
These five aggregate functions do not limit the types of summaries you can use. You can implement your own aggregate functions. For this purpose, set the SummaryType property to the SummaryItemType.Custom value and write a GridView.CustomSummaryCalculate event handler.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SummaryType property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.