Skip to main content

ExpressionEditorControl Class

The Expression Editor in the AutoComplete mode.

Namespace: DevExpress.Xpf.ExpressionEditor

Assembly: DevExpress.Xpf.ExpressionEditor.v24.1.dll

NuGet Package: DevExpress.Wpf.ExpressionEditor

Declaration

public class ExpressionEditorControl :
    Control,
    IAutoCompleteExpressionEditor,
    ISupportExpressionString

The following members return ExpressionEditorControl objects:

Remarks

The Expression Editor provides the capability to create and edit expressions in DevExpress WPF controls (for example, Data Grid). The expression editor supports numerous standard functions and operators that allow you to perform different string, date-time, logical and math operations over data. See the Invoking Expression Editor topic to learn how to invoke the expression editor.

ExpressionEditorAutoComplete

The AutoComplete mode supports intelligent code completion, syntax highlighting and immediate error indication. Refer to the Expression Editor Capabilities topic to learn more.

The expression editor in AutoComplete mode is an ExpressionEditorControl class instance that is included in the DevExpress.Xpf.ExpressionEditor assembly. If the Global Assembly Cache stores this assembly, the AutoComplete mode is used by default.

Refer to the following help topic for more information on how to customize the expression editor: Expression Editor Customization.

Standalone Mode

You can use the Expression Editor as a standalone control:

  1. Add the control to the window:

    <Window ...
            xmlns:dxexpression="http://schemas.devexpress.com/winfx/2008/xaml/expressioneditor">
        <dxexpression:ExpressionEditorControl Name="editor"/>
    </Window>
    
  2. Use the ExpressionEditorContextHelper.GetContext method to define columns:

    var context = ExpressionEditorContextHelper.GetContext(true, true, true);
    context.Columns.Add(new ColumnInfo("Custom Category") {
        Name = "Custom variable",
        Description = "Custom variable description",
        Type = typeof(string)
    });
    editor.Context = context;
    editor.EditValue = "CustomVariable + 1"
    
  3. Execute the SaveCommand to update the editor value:

    void Button_Click(object sender, RoutedEventArgs e) {
        editor.SaveCommand.Execute(null);
        MessageBox.Show(editor.EditValue);
    }
    
See Also