Skip to main content

ReportExpressionEditorCustomizationService Class

Allows you to adjust the list of functions available in the Expression Editor.

Namespace: DevExpress.XtraReports.UserDesigner

Assembly: DevExpress.XtraReports.v23.2.Extensions.dll

NuGet Package: DevExpress.Win.Reporting

Declaration

public abstract class ReportExpressionEditorCustomizationService :
    IExpressionEditorCustomizationService

Remarks

The ReportExpressionEditorCustomizationService allows you to customize Expression Editor invoked for expressions in the calculated fields, and for custom expressions in the Filter Editor. For more information, review the following help topics:

To use the service, you should implement the ReportExpressionEditorCustomizationService descendant, override the BeforeRun and/or the BeforeFilterEditorRun methods, and add the service to the XRDesignMdiController instance.

The following code snippet removes the FormatString function from a list of functions displayed in the Expression Editor:

public partial class Form1 : DevExpress.XtraEditors.XtraForm {
    protected override void OnLoad(EventArgs e) {
        base.OnLoad(e);
        this.reportDesigner1.AddService(typeof(ReportExpressionEditorCustomizationService), 
        new MyReportExpressionEditorCustomizationService());       
    }
    public Form1() {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e) {
        XtraReport1 report = new XtraReport1();
        this.reportDesigner1.OpenReport(report);
    }
}

class MyReportExpressionEditorCustomizationService : ReportExpressionEditorCustomizationService {
        public override void BeforeRun(string expressionString, IExpressionEditorView expressionEditorView, ExpressionEditorContext expressionEditorContext) {            
            FunctionInfo formatStringFunc = expressionEditorContext.Functions.FirstOrDefault(x => x.Name == "FormatString");
            expressionEditorContext.Functions.Remove(formatStringFunc);
            base.BeforeRun(expressionString, expressionEditorView, expressionEditorContext);
        }
    }
}

Inheritance

Object
ReportExpressionEditorCustomizationService
See Also