Invoking Expression Editor
This topic describes how to invoke the Expression Editor in the GridControl and the PivotGridControl:
Invoking at Design Time
Click the ColumnBase.UnboundExpression (or PivotGridField.UnboundExpression) property’s ellipsis button to invoke the expression editor at design time:
Invoking in Code
Call the DataViewBase.ShowUnboundExpressionEditor (or PivotGridControl.ShowUnboundExpressionEditor) method to invoke the expression editor in code:
gridControl.View.ShowUnboundExpressionEditor(gridControl.Columns["DiscountAmount"]);
The code sample below demonstrates how to create a button that allows invoking the expression editor:
<dxg:GridControl Name="gridControl">
<dxg:GridControl.Columns>
<!---->
<dxg:GridColumn FieldName="DiscountAmount" />
</dxg:GridControl.Columns>
<dxg:TableView Name="view" />
</dxg:GridControl>
<Button Command="{Binding Commands.ShowUnboundExpressionEditor, ElementName=view}"
CommandParameter="DiscountAmount">Show Expression Editor</Button>
Invoking at Runtime
Right-click a column to which you want to specify an expression, and select the Expression Editor… in the displayed context menu to invoke the expression editor:
The column’s context menu does not contain the Expression Editor… menu item by default. Set the ColumnBase.AllowUnboundExpressionEditor (or PivotGridField.AllowUnboundExpressionEditor) property to true to add this menu item to the context menu:
<dxg:GridControl>
<dxg:GridControl.Columns>
<!---->
<dxg:GridColumn FieldName="DiscountAmount" AllowUnboundExpressionEditor="True" />
</dxg:GridControl.Columns>
</dxg:GridControl>