Skip to main content

PivotGridCustomTotalCollection Class

Represents a collection of custom totals for a field.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v23.2.dll

NuGet Package: DevExpress.Win.PivotGrid


public class PivotGridCustomTotalCollection :

The following members return PivotGridCustomTotalCollection objects:


A field’s PivotGridField.CustomTotals property of the PivotGridCustomTotalCollection class represents a collection of custom totals.

The PivotGrid control allows you to display automatic or custom totals for outer column fields and row fields. By default, the field’s PivotGridFieldBase.TotalsVisibility property is set to PivotTotalsVisibility.AutomaticTotals, so automatic totals are displayed. To display custom totals, do the following:

When a sequence of operations is performed each of which affects the control’s appearance, the PivotGrid control updates itself after each such operation. To prevent excessive updates you should enclose the code within calls to the PivotGridControl.BeginUpdate and PivotGridControl.EndUpdate methods. For instance, when setting custom totals for a field via code you can enclose the code within the BeginUpdate and EndUpdate method calls. In this case, the control will be updated only once - by the EndUpdate method.


In the following example, four custom totals are added for a ‘Category Name’ row field. They will calculate the total Average, Sum, Min and Max values against the currently displayed data field.

The result is shown below.


using DevExpress.Data.PivotGrid;
using DevExpress.XtraPivotGrid;

// Get a reference to the CategoryName field.
PivotGridField field = pivotGridControl1.Fields["CategoryName"];
try {
   // Clear the custom total collection.
   // Add four items to the custom total collection to calculate the Average, 
   // Sum, Max and Min summaries.
   // Make the custom totals visible for this field.
   field.TotalsVisibility = PivotTotalsVisibility.CustomTotals; 
finally {


See Also