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

Expression Editor Customization

You can customize the Expression Editor. For example, the image below shows the expression editor with the following changes:

  • The Columns category is renamed to Fields.
  • The Now function is removed from the date-time functions list.

ExpressionEditorCustomization

Perform the following steps to customize the expression editor:

  1. Handle the DataViewBase.UnboundExpressionEditorCreated (or PivotGridControl.UnboundExpressionEditorCreated) event.
  2. Use one of the following properties to obtain the expression editor:

  3. Specify the required expression editor’s properties.

The following code sample demonstrates how to customize the AutoComplete expression editor as shown in the image above:

<dxg:GridControl>
   <!---->            
   <dxg:GridControl.View>
      <dxg:TableView UnboundExpressionEditorCreated="OnUnboundExpressionEditorCreated" />
   </dxg:GridControl.View>
</dxg:GridControl>
void OnUnboundExpressionEditorCreated(object sender, UnboundExpressionEditorEventArgs e) {
   var expressionEditorContext = e.AutoCompleteExpressionEditorControl.Context;   
   var nowFunction = expressionEditorContext.Functions.FirstOrDefault(f => string.Equals(f.Name, "now", StringComparison.OrdinalIgnoreCase));
   if (nowFunction != null) {
      expressionEditorContext.Functions.Remove(nowFunction);
   }   
   foreach (var columnInfo in expressionEditorContext.Columns) {
      columnInfo.Category = "Fields";
   }
}
See Also