WinReportServiceController.DesignFormCreated Event

Occurs after the Report Designer form is created, but before a report is loaded into it.

Namespace: DevExpress.ExpressApp.Reports.Win

Assembly: DevExpress.ExpressApp.Reports.Win.v18.1.dll

Syntax

public event EventHandler<DesignFormEventArgs> DesignFormCreated

The event handler receives an argument of the DevExpress.ExpressApp.Reports.Win.DesignFormEventArgs type.

Handle this event to customize the design form. You can, for example, add or remove particular items from the design form toolbox.

using System.Drawing.Design;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Reports.Win;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
//...
public class ReportToolBoxController : ViewController {
    private WinReportServiceController reportService;
    protected override void OnActivated() {
        base.OnActivated();
        reportService = Frame.GetController<WinReportServiceController>();
        if (reportService != null)
            reportService.DesignFormCreated += reportService_DesignFormCreated;
    }
    void reportService_DesignFormCreated(object sender, DesignFormEventArgs e) {
        e.Report.DesignerLoaded += Report_DesignerLoaded;
    }
    void Report_DesignerLoaded(object sender, DesignerLoadedEventArgs e) {
        IToolboxService ts = (IToolboxService)e.DesignerHost.GetService(typeof(IToolboxService));
        ts.AddToolboxItem(new ToolboxItem(typeof(MyControl)), "New Category");
    }
    protected override void OnDeactivated() {
        base.OnDeactivated();
        if (reportService != null)
            reportService.DesignFormCreated -= reportService_DesignFormCreated;
    }
}
public class MyControl : XRControl {
    //...
}

See Also