Skip to main content

CalculationBindingBase.Source Property

Gets or sets a data binding object that provides the data to calculate.

Namespace: DevExpress.PivotGrid.DataBinding

Assembly: DevExpress.PivotGrid.v23.2.Core.dll

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

[DefaultValue(null)]
public DataBindingBase Source { get; set; }

Property Value

Type Default Description
DataBindingBase null

A DataBindingBase descendant that provides the source data.

Remarks

A Source can be a DataSourceColumnBindingBase descendant that retrieves data from a data source or any other DataBindingBase descendant that provides calculated data.

Run Demo: Field Calculation Bindings

The following example shows how to create the RunningTotalBinding calculation binding. The Pivot Grid binds the fieldProductAmountRunningTotal field to the result of the running total calculation.

  1. Create an instance of the RunningTotalBinding class with the Source property set to the DataBindingBase descendant’s instance.
  2. Specify the window frame and summary type.
  3. Assign the RunningTotalBinding instance to the PivotGridField.DataBinding property.
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