Skip to main content

DesignerLoadedEventArgs.DesignerHost Property

Gets the designer host which provides all the services that are available for editing a report in its End-User Designer.

Namespace: DevExpress.XtraReports.UserDesigner

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public IDesignerHost DesignerHost { get; }

Property Value

Type Description
IDesignerHost

An object implementing the IDesignerHost interface that is used to manage designer transactions and components.

Remarks

When a report is loaded into the End-User Designer, then the designer’s host provides all the services needed to support the editing of the report. These services can be obtained via its GetService method. Review the following topic for more information: IDesignerHost.

Example

This example adds a custom control to the toolbox in the End-User Report Designer for Winforms. The XtraReport.DesignerLoaded event is used to access the toolbox service.

Tip

This code adds the XRZipCode control to the toolbox. It is hidden by default because most countries do not use it.

See Use Custom Controls to learn how to create custom report controls and add them to a Report Designer’s toolbox.

using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
using System.Drawing.Design;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    XtraReport1 report = new XtraReport1();
    ReportDesignTool designTool = new ReportDesignTool(report);
    report.DesignerLoaded += report_DesignerLoaded;
    designTool.ShowRibbonDesignerDialog();
}

void report_DesignerLoaded(object sender, DesignerLoadedEventArgs e) {
    // Access the Toolbox service.
    IToolboxService toolboxService = 
        (IToolboxService)e.DesignerHost.GetService(typeof(IToolboxService));

    // Add a custom control to the default category.
    toolboxService.AddToolboxItem(new ToolboxItem(typeof(XRZipCode)));

    // Add a custom control to a new category.
    // toolboxService.AddToolboxItem(new ToolboxItem(typeof(XRZipCode)), "New Category");
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the DesignerHost property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also