Skip to main content

PivotGridControl.CustomSummary Event

Enables summary values to be calculated manually.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v14.2.dll

#Declaration

public event PivotCustomSummaryEventHandler CustomSummary

#Event Data

The CustomSummary event's handler receives an argument of the PivotCustomSummaryEventArgs type. The following properties provide information specific to this event:

Property Description
ColumnField Gets the column field that corresponds to the current cell.
ColumnFieldValue Gets the value of the column field which corresponds to the current cell.
CustomValue Gets or sets a custom summary value.
DataField Gets the data field against which the summary is calculated.
FieldName Gets the name of the data field against which the summary is calculated.
RowField Gets the row field that corresponds to the current cell.
RowFieldValue Gets the value of the row field which corresponds to the current cell.
SummaryValue Gets an object which contains the values of the predefined summaries that are calculated for the current cell.
ThreadSafeColumnField Gets the column field that corresponds to the current cell. Provides read-only access to field settings.
ThreadSafeDataField Gets the data field against which the summary is calculated. Provides read-only access to field settings.
ThreadSafeRowField Gets the row field that corresponds to the current cell.

#Remarks

The PivotGridControl calculates summaries against data fields. A field's PivotGridField.SummaryType property specifies the type of summary function. The control automatically calculates all the predefined summary functions (see the FieldSummaryType topic for a list of the available functions) and it allows custom summaries to be calculated manually via the CustomSummary event.

To calculate a custom summary for a specific data field set its PivotGridField.SummaryType property to FieldSummaryType.Custom. In this case, the CustomSummary event will fire for each cell that corresponds to this data field.

For instance, this event enables a custom summary to be calculated against multiple fields, particular records, etc. Use the PivotCustomSummaryEventArgs.CreateDrillDownDataSource method to get a list of the records that correspond to the current cell. This list can then be traversed to calculate a summary in a custom manner. The custom summary value should be assigned to the PivotCustomSummaryEventArgs.CustomValue parameter.

For each cell the PivotGridControl calculates all the predefined summaries (AVERAGE, MIN, MAX, SUM, etc). The calculated values can be accessed via the PivotCustomSummaryEventArgs.SummaryValue property. You can use them in custom summary calculations.

See Also