Back to Devexpress

PivotGridField.DataBinding Property

wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridfield-0245b51b.md

latest8.1 KB
Original Source

PivotGridField.DataBinding Property

Gets or sets an object that specifies the Pivot Grid field’s source data.

Namespace : DevExpress.Xpf.PivotGrid

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

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
public DataBinding DataBinding { get; set; }
vb
Public Property DataBinding As DataBinding

Property Value

TypeDescription
DataBinding

A DataBinding object that specifies the source data for the Pivot Grid fields.

|

Remarks

Pivot Grid uses the Binding API to bind Pivot Grid fields to data. Data binding sources can be columns in a data source, calculated expressions, or window calculations.

Refer to the following topics for information on how to bind Pivot Grid fields to data:

Each specified binding object is a DataBinding descendant. This object is assigned to the Pivot Grid field’s DataBinding property.

The following code snippet illustrates the Pivot Grid’s Product Sales field bound to the Extended Price source column:

xaml
<dxpg:PivotGridControl>
    <dxpg:PivotGridControl.Fields>
      <dxpg:PivotGridField
          Area="DataArea"
          AreaIndex="5"
          Caption="Product Sales"
          CellFormat="C"
          Name="fieldSales">
          <dxpg:PivotGridField.DataBinding>
              <dxpg:DataSourceColumnBinding ColumnName="Extended Price" />
          </dxpg:PivotGridField.DataBinding>
        </dxpg:PivotGridField>
      </dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>

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.

wpf-pivotgrid-how-to-display-underlying-data-asynchronously/CS/WpfDrillDownDataSourceExample/MainWindow.xaml#L38

xml
Caption="Product Sales">
<dxpg:PivotGridField.DataBinding>
    <dxpg:DataSourceColumnBinding ColumnName="ExtendedPrice"/>

wpf-pivotgrid-hide-column-totals/CS/HowToBindToMDB/MainWindow.xaml#L14

xml
<dxpg:PivotGridField Name="fieldOrderID" Area="RowArea">
    <dxpg:PivotGridField.DataBinding>
    <dxpg:DataSourceColumnBinding ColumnName="OrderID"/>

wpf-pivotgrid-how-to-display-underlying-data/CS/WpfDrillDownDataSourceExample/MainWindow.xaml#L37

xml
Caption="Product Sales">
<dxpg:PivotGridField.DataBinding>
    <dxpg:DataSourceColumnBinding ColumnName="ExtendedPrice"/>

wpf-pivot-grid-apply-format-conditions-to-data-cells/CS/WpfPivotGridConditionalFormatting/MainWindow.xaml#L40

xml
Name="fieldCountry" AreaIndex="0">
<dxpg:PivotGridField.DataBinding>
    <dxpg:DataSourceColumnBinding ColumnName="Country"/>

wpf-pivot-grid-obtain-underlying-data/CS/ObtainUnderlyingData/MainWindow.xaml#L64

xml
Name="fieldCountry" >
<dxpg:PivotGridField.DataBinding>
    <dxpg:DataSourceColumnBinding ColumnName="Country"/>

wpf-pivot-grid-bind-to-an-olap-cube-net6/CS/HowToBindOLAP/MainWindow.xaml.cs#L33

csharp
// Populate fields with data.
fieldMeasuresInternetSalesAmount.DataBinding =
    new DataSourceColumnBinding("[Measures].[Internet Sales Amount]");

wpf-pivot-grid-bind-to-an-mdb-database/CS/HowToBindToMDB/MainWindow.xaml.cs#L38

csharp
DataBinding orderDateBinding = pivotGridControl1.Fields["OrderDate"].DataBinding;
(orderDateBinding as DataSourceColumnBinding).GroupInterval = FieldGroupInterval.DateYear;

wpf-pivotgrid-hide-column-totals/CS/HowToBindToMDB/MainWindow.xaml.cs#L38

csharp
field.Area = area;
field.DataBinding = new DataSourceColumnBinding(columnName);
field.AreaIndex = index;

wpf-pivot-grid-change-summary-display-type/VB/HeaderMenuCustomizationExample/HeaderMenuHelper.vb#L98

vb
Case FieldSummaryDisplayType.AbsoluteVariation
    field.DataBinding = New DifferenceBinding(sourceBinding, CalculationPartitioningCriteria.RowValue, CalculationDirection.DownThenAcross, DifferenceTarget.Previous, DifferenceType.Absolute)
Case FieldSummaryDisplayType.PercentVariation

wpf-pivot-grid-bind-to-an-olap-cube-net6/VB/HowToBindOLAP/MainWindow.xaml.vb#L31

vb
' Populate fields with data.
fieldMeasuresInternetSalesAmount.DataBinding = New DataSourceColumnBinding("[Measures].[Internet Sales Amount]")

wpf-pivot-grid-bind-to-an-mdb-database/VB/HowToBindToMDB/MainWindow.xaml.vb#L34

vb
AddField("Price", FieldArea.DataArea, "Extended Price", 0)
Dim orderDateBinding As DataBinding = pivotGridControl1.Fields("OrderDate").DataBinding
TryCast(orderDateBinding, DataSourceColumnBinding).GroupInterval = FieldGroupInterval.DateYear

See Also

PivotGridField Class

PivotGridField Members

DevExpress.Xpf.PivotGrid Namespace