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

PivotGridField.UnboundExpression Property

Gets or sets an expression used to evaluate values for the current unbound field.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v20.2.dll


public string UnboundExpression { get; set; }

Property Value

Type Default Description


A String that specifies an expression used to evaluate values for the current field.


You can create an unbound field by setting the PivotGridFieldBase.UnboundType property to a specific data type. The PivotGridFieldBase.FieldName property must be set to a unique value that does not refer to any field in the pivot grid’s data source. Unbound fields can be populated manually via the PivotGridControl.CustomUnboundFieldData event, or by specifying an expression via the UnboundExpression property, used to evaluate values for this field. The Expressions section describes the syntax for creating expressions. To refer to a field when specifying an unbound expression in code, use the PivotGridFieldBase.ExpressionFieldName property. The PivotGridOptionsData.DataFieldUnboundExpressionMode property allows you to specify whether the expressions are calculated, based on the data source records, or summary values.


When the PivotGridOptionsData.DataFieldUnboundExpressionMode property is set to DataFieldUnboundExpressionMode.UseSummaryValues, the PivotGridFieldBase.FieldName and PivotGridFieldBase.Name properties cannot be used in unbound expressions to refer to fields.

If the PivotGridFieldOptionsEx.ShowUnboundExpressionMenu option is enabled, an end-user can edit a field’s expression via the Expression Editor at runtime. See PivotGridFieldOptionsEx.ShowUnboundExpressionMenu, for more information.

When changing the UnboundExpression property, the PivotGridControl.FieldUnboundExpressionChanged event fires.

To learn more about unbound fields, see Unbound Fields.


The following code snippet demonstrates how to create an unbound field in code and use the PivotGridField.UnboundExpression property to supply data. In this example, extended price values are calculated as follows:

[Quantity] * [UnitPrice] * (1 - [Discount]).

Pivot Grid field names are obtained using the PivotGridFieldBase.ExpressionFieldName property.

PivotGridField fieldExtendedPrice = new PivotGridField() { Caption = "Extended Price", Area = PivotArea.DataArea };
fieldExtendedPrice.UnboundFieldName = "fieldExtendedPrice";
fieldExtendedPrice.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
fieldExtendedPrice.UnboundExpression = string.Format("[{0}] * [{1}] * (1 - [{2}])", 
    fieldQuantity.ExpressionFieldName, fieldUnitPrice.ExpressionFieldName, fieldDiscount.ExpressionFieldName);
See Also