GridSummaryItem.SummaryType Property

Gets or sets the aggregation function type.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v21.2.dll

Declaration

[DefaultValue(SummaryItemType.None)]
[XtraSerializableProperty(1)]
[DXCategory("Behavior")]
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.

See Also