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

CustomFunctions.Register(ICustomFunctionOperator[]) Method

Registers the specified custom functions in the Expression Editor in the End-User Report Designer.

Namespace: DevExpress.XtraReports.Expressions

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

public static void Register(
    params ICustomFunctionOperator[] functionOperators
)

Parameters

Name Type Description
functionOperators ICustomFunctionOperator[]

A collection of ICustomFunctionOperator objects specifying custom functions to register.

Remarks

The Register method registers a custom function in the Expression Editor to use for specifying control expression bindings and calculated fields expressions along with built-in functions.

You can declare a custom function by implementing an ICustomFunctionOperator interface that provides the base functionality. Implement an ICustomFunctionOperatorBrowsable interface if you want to specify additional function information such as a category, description or parameter count.

The following example demonstrates how to create a simple custom function and register it in the End-User Designer by calling the static Register method.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Expressions;
// ...

public class MyCustomFunction : ICustomFunctionOperator {

    object ICustomFunctionOperator.Evaluate(params object[] operands) {
        // Insert your custom logic here.
        // For demonstration purposes, multiply an operand value to 10.
        return (Convert.ToDouble(operands[0]) * 10);
    }

    string ICustomFunctionOperator.Name {
        get { return "MyFunction"; }
    }

    Type ICustomFunctionOperator.ResultType(params Type[] operands) {
        return typeof(double);
    }
}

public Form1() {
    // ...
    CustomFunctions.Register(new MyCustomFunction());        
    reportDesigner1.OpenReport(new XtraReport());            
}
See Also