Skip to main content
A newer version of this page is available. .

RunningTotalBinding Class

Defines the calculation that aggregates values cumulatively in the window.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v21.2.dll

NuGet Packages: DevExpress.Win.Design, DevExpress.Win.PivotGrid

Declaration

public class RunningTotalBinding :
    RunningTotalBindingBase

Remarks

To bind a PivotGrid field to the result of the calculation, follow the steps listed below.

  1. Create an instance of the RunningTotalBinding class with the Source property set to the DataBindingBase descendant instance.
  2. Specify the window frame and summary type.
  3. Assign the RunningTotalBinding instance to the PivotGridField.DataBinding property.

Example

The following code snippet illustrates the use of the Data Binding API:

Note

The complete sample project is available in the DevExpress Demo Center: Code Examples - Optimized Mode - Field Calculation Bindings module in the XtraPivotGrid MainDemo.

pivotGridControl.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.Optimized;

PivotGridField fieldProductAmount = new PivotGridField()
{
    Area = PivotArea.DataArea,
    Caption = "Product Sales",
    Name = "fProductAmount"
};

PivotGridField fieldProductAmountRunningTotal = new PivotGridField()
{
    Area = PivotArea.DataArea,
    Caption = "Running Total",
    Name = "fRunningTotal"

};
DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ProductAmount");
//Bind a field to a column in the data source.
fieldProductAmount.DataBinding = productAmountBinding;
//Calculate a running summary on the column.
fieldProductAmountRunningTotal.DataBinding = new RunningTotalBinding()
{
    Source = productAmountBinding,
    PartitioningCriteria = CalculationPartitioningCriteria.ColumnValue,
    SummaryType = PivotSummaryType.Sum
};
pivotGridControl.Fields.AddRange(new PivotGridField[] {
    fieldProductAmount,
    fieldProductAmountRunningTotal
});
See Also