Invoking Expression Editor
- 2 minutes to read
This topic describes how to invoke the Expression Editor in the GridControl and the PivotGridControl.
Invoking at Design Time
Note
The Expression Editor is not available in the new WPF XAML Designer. For information on the difference between the old and new WPF XAML designers, refer to the Quick Actions and Smart Tags section.
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>