Bind Pivot Grid Fields to Data Columns
Pivot Grid uses the Binding API to bind Pivot Grid fields to data. This topic describes how to use the Binding API
to bind a Pivot Grid field to a data source column when the Pivot Grid uses the Optimized data processing engine.
Important
You cannot bind the Pivot Grid to data at design time in .NET 5+ projects.
Follow the steps below to bind a Pivot Grid field to a data source column in code:
- Create a
DataSourceColumnBinding
instance. - Set the DataSourceColumnBinding.ColumnName property to the name of a data source column.
- Assign the
DataSourceColumnBinding
object to the PivotGridField.DataBinding property.
The following code snippet illustrates the Pivot Grid’s Product Sales
field bound to the Extended Price
source column:
<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>
See Also