Skip to main content

Add Custom Controls to the Toolbox

  • 2 minutes to read

Add to the Visual Studio Toolbox

.NET and .NET Framework

To add a custom control to the Visual Studio Toolbox, set the ToolboxItem attribute to true for the custom control class:

[ToolboxItem(true)]
public class CustomControl : XRControl {
    //...
}

If you implement a custom control in a report project, the control appears in the Toolbox after you specify the ToolboxItem attribute and rebuild the project.

.NET Framework (Custom Control in a Standalone Assembly)

If you store a custom control in a separate assembly, add a toolbox item from that assembly manually. For this, right-click the DX.24.2: Report Controls Toolbox tab, and select Choose items.

Toolbox Choose Items

In the invoked Choose Toolbox Items dialog, click Browse and specify the path to the assembly. Then select the added assembly:

Choose Toolbox Items Dialog

Specify an Icon for the Visual Studio Toolbox

After you add a custom control to the Toolbox, the control’s icon in the Toolbox and Report Explorer is set to the default icon. If you implement a control in a separate assembly, you can specify a custom bitmap icon for this control. To do this, do the following:

  1. Add an icon to the project where the control class is stored and set the icon’s Build Action property to Embedded Resource.
  2. Apply the ToolboxBitmapAttribute attribute to the control’s class to specify the icon:

    using System.Drawing;
    //...
    
    [ToolboxBitmapAttribute(typeof(CustomControl), "IconName")]
    public class CustomControl : XRControl { ... }
    
  3. Rebuild the project and add the updated control to the toolbox.

Add to the End-User Report Designer Toolbox

Refer to the following tutorials for information on how to add a custom control to an End-User Report Designer’s toolbox on different application platforms: