Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WinReportServiceController.CreateCustomDesignForm Event

Occurs when the Report Designer form is created.

Namespace: DevExpress.ExpressApp.ReportsV2.Win

Assembly: DevExpress.ExpressApp.ReportsV2.Win.v24.2.dll

#Declaration

public event EventHandler<CreateCustomDesignFormEventArgs> CreateCustomDesignForm

#Event Data

The CreateCustomDesignForm event's data class is DevExpress.ExpressApp.ReportsV2.Win.CreateCustomDesignFormEventArgs.

#Remarks

Handle this event to specify a custom Report Designer form. In the event handler, pass your custom form to the DesignForm parameter. An example is provided in the How to: Use the Custom WinForms Report Designer topic.

You can also use the CreateCustomDesignForm event to customize the default Report Designer. For instance, you can add a custom Data Source component (inherited from DataSourceBase) to the designer’s toolbox:

using DevExpress.ExpressApp.ReportsV2.Win;
// ...
public class AddCustomDataSourceController : ViewController {
    private WinReportServiceController reportService;
    protected override void OnActivated() {
        base.OnActivated();
        reportService = Frame.GetController<WinReportServiceController>();
        if (reportService != null) {
             reportService.CreateCustomDesignForm += delegate(object sender, CreateCustomDesignFormEventArgs e) {
                e.DesignForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;
                ((XtraForm)designForm).FormClosed += designForm_FormClosed;
            };
        }
    }
    private void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs args) {
        AddToolboxItem(args.DesignerHost);
    }
    private void AddToolboxItem(IServiceProvider serviceProvider) {
        IToolboxService ts = (IToolboxService)serviceProvider.GetService(typeof(IToolboxService));
        ts.AddToolboxItem(new ToolboxItem(typeof(CustomDataSource)), "Custom Category");
    }
    private void designForm_FormClosed(object sender, FormClosedEventArgs e) {
        ((IDesignForm)sender).DesignMdiController.DesignPanelLoaded -= new DesignerLoadedEventHandler(DesignMdiController_DesignPanelLoaded);
        ((XtraForm)sender).FormClosed -= new FormClosedEventHandler(designForm_FormClosed);
    }
}
See Also