Skip to main content
A newer version of this page is available. .

Add Custom Controls to the Toolbox

  • 2 minutes to read

Add to the Visual Studio Toolbox

Do the following to add a custom control to the Visual Studio Toolbox:

  1. Set the ToolboxItem attribute to true for the custom control class:

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

    When 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.

    If you store a custom control in a separate assembly, follow steps 2-3 after you specify the ToolboxItem attribute to reference the assembly in the project:

  2. In the Toolbox, right-click the DX.20.2: Report Controls tab and select Choose items.

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

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: