The requested page is not available for the requested platform. You are viewing the content for Default platform.

Rename Toolbox Items in End-User Report Designer

This example illustrates how to rename toolbox items in an End-User Report Designer by handling the XRDesignMdiController.DesignPanelLoaded event and accessing the toolbox service.

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

private void button1_Click(object sender, System.EventArgs e) {
    // Create a Design Tool with an assigned report instance.
    ReportDesignTool designTool = new ReportDesignTool(new XtraReport1());

    // Access the standard or ribbon-based Designer form.
    //IDesignForm designForm = designTool.DesignForm;
    IDesignForm designForm = designTool.DesignRibbonForm;

    // Handle the Design Panel's Loaded event.
    designForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;

    // Load a Report Designer in a dialog window.
    // designTool.ShowDesignerDialog();
    designTool.ShowRibbonDesignerDialog();
}

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

    // Access the collection of toolbox items.
    ToolboxItemCollection toolboxItems = toolboxService.GetToolboxItems();

    // Iterate through toolbox items and customize their names.
    foreach (ToolboxItem item in toolboxItems) {
        item.DisplayName = "Custom " + item.DisplayName;
    }
}
See Also