Skip to main content

PercentOfTotalBinding Class

Defines the calculation of a percentage of all values in the window.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v21.2.dll


public class PercentOfTotalBinding :


To bind a PivotGrid field to the result of the calculation, do the following:

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


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


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 fieldProductAmountPercentOfTotal = new PivotGridField()
    Area = PivotArea.DataArea,
    Caption = "Percent Of Total",
    Name = "fPercentOfTotal"

DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ProductAmount");
//Bind a field to a column in the data source.
fieldProductAmount.DataBinding = productAmountBinding;
//Calculate the percentage of each value in the column out of the sum of the values in a pivot field group.
fieldProductAmountPercentOfTotal.DataBinding = new PercentOfTotalBinding()
    Source = productAmountBinding,
    PartitioningCriteria = CalculationPartitioningCriteria.ColumnValueAndRowParentValue
pivotGridControl.Fields.AddRange(new PivotGridField[] {
See Also