ActiveReports 18 .NET Edition
Developers / Create Designer and Viewer Applications / End User Report Designer in WinForms Application / Use End-User Report Designer API / Customize the Toolbox
In This Topic
    Customize the Toolbox
    In This Topic

    You can change the Designer toolbox items to show specific controls or remove a control from the toolbox.

    Add Toolbox panel

    The code example below demonstrates adding a Toolbox panel to the Designer using the Designer.Toolbox property.

    C#. Paste the code in Form.cs
    Copy Code
    using GrapeCity.ActiveReports.Design;
    using GrapeCity.ActiveReports.Design.ReportExplorer;
    class MyForm : Form
    {
      MyForm()
      {
        var _designer = new Designer() { Dock = DockStyle.Fill };
        var toolbox = new Toolbox { Dock = DockStyle.Right };
        _designer.Toolbox = toolbox;
        Controls.Add(_designer);
        Controls.Add(toolbox);
      }
    }
    

    Control the Toolbox items

    With the Toolbox.ConfigureToolboxItems method, you can control items that are available in the Toolbox.

    Toolbox

    You first need to define a state provider as demonstrated in the sample below.

    C#
    Copy Code
    class ToolboxStateProvider : IToolboxUser
    {
       public bool GetToolSupported(ToolboxItem tool)
        {
            if (tool.TypeName == "GrapeCity.ActiveReports.Design.DdrDesigner.Designers.BandedList.BandedListDesigner")
                return true;
            return false;
        }
        public void ToolPicked(ToolboxItem tool)  { }
    }
    

    After the state provider is configured, you need to configure the Toolbox with it as demonstrated in the sample below.

    C#
    Copy Code
    toolbox.ConfigureToolboxItems(new ToolboxStateProvider());
    

    Remove an item from the Toolbox

    You can use the Toolbox.RemoveToolboxItem method together with the Toolbox.GetToolboxItems method to remove an item from the Toolbox.

    C#
    Copy Code
    private static void RemoveBandedListFromToolBox(Toolbox toolbox)
    {
      //Find the item to be removed.
      var bandedList = toolbox.GetToolboxItems()
          .OfType<ToolboxItem>()
          .Single(items => items.TypeName.EndsWith("BandedListDesigner"));
      //Remove the banded list item from the toolbox.
      toolbox.RemoveToolboxItem(items);
    }