Back to Devexpress

Invoking Expression Editor

wpf-119632-common-concepts-expressions-invoking-expression-editor.md

latest3.5 KB
Original Source

Invoking Expression Editor

  • May 27, 2025
  • 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:

csharp
gridControl.View.ShowUnboundExpressionEditor(gridControl.Columns["DiscountAmount"]);

The code sample below demonstrates how to create a button that allows invoking the expression editor:

xaml
<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:

xaml
<dxg:GridControl>
   <dxg:GridControl.Columns>
      <!---->
      <dxg:GridColumn FieldName="DiscountAmount" AllowUnboundExpressionEditor="True" />
   </dxg:GridControl.Columns>
</dxg:GridControl>

See Also

Expression Editor Customization

Unbound Columns

Bind Pivot Grid Fields to Calculated Expressions

Expression Editor Modes

Expression Editor Customization