PivotGridControl.ShowExpressionEditor(PivotGridField) Method
Invokes the Expression Editor where a user can edit the specified field’s binding expression.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
field | PivotGridField | A calculated field whose expression is edited in the Expression Editor. |
Returns
Type | Description |
---|---|
Boolean | true if the OK button is pressed when a user closes the editor; otherwise, false. |
Remarks
Pivot Grid allows you to create calculated fields. They do not obtain their values from fields in the data source. Instead, you specify a binding expression. The expression can be a formula or an aggregate function. You can use the following classes to create a calculated field:
You can allow users to edit or create new custom expressions in the Expression Editor at runtime. To accomplish this, set the PivotGridFieldOptionsEx.ShowExpressionEditorMenu property to true
to add the Expression Editor command to the field’s context menu or call the ShowExpressionEditor
method to invoke the Expression Editor.
Note
You cannot use the Expression Editor dialog in OLAP mode.
The following code snippet shows how to invoke the Expression editor for pivotGridField2
on a mouse click:
private void pivotGridControl1_MouseClick(object sender, MouseEventArgs e) {
PivotGridHitInfo info = pivotGridControl1.CalcHitInfo(new Point(e.X, e.Y));
if (info != null && info.HeaderField == pivotGridField2) {
pivotGridControl1.ShowExpressionEditor(pivotGridField2);
}
}
Use the PivotGridOptionsBehavior.ExpressionEditorMode property to specify the Expression Editor’s version.