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

PivotGridFieldBase.DataBinding Property

Gets or sets an object that specifies the field’s source data (Optimized mode).

Namespace: DevExpress.XtraPivotGrid

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

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.WindowsDesktop.PivotGrid.Core

Declaration

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

Property Value

Type Default Description
DataBindingBase *null*

A DataBindingBase descendant that specifies the source data and calculation type.

Remarks

In Optimized mode use the DataBinding property to specify the field’s source data with the Data Binding API.

The key concept of the Data Binding API is the data binding source. All functionality related to calculations are encapsulated into the data binding source - the DataBindingBase descendant that is assigned to the field’s DataBinding property.

Note

The Data Binding API works in Optimized mode if the DataBinding property is set. Otherwise, the fields are divided into bound and unbound and the approach introduce earlier in Legacy mode is in effect.

The code snippet below demonstrates how to use the Data Binding API to calculate running totals.

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 of the column.
fieldProductAmountRunningTotal.DataBinding = new RunningTotalBinding() {
    Source = productAmountBinding,
    PartitioningCriteria = CalculationPartitioningCriteria.ColumnValue,
    SummaryType = PivotSummaryType.Sum
};

pivotGridControl.Fields.AddRange(new PivotGridField[] { fieldProductAmount, fieldProductAmountRunningTotal });

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataBinding property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also