[]
Gets or sets a value representing the IToolboxService implementation for the report designer.
[Browsable(false)]
public IToolboxService Toolbox { get; set; }
Type | Description |
---|---|
IToolboxService | An instance of IToolboxService that provides access to the toolbox service used by the report designer. |
The toolbox service is a key component in the report designer that manages the toolbox items, such as controls and components, which can be dragged onto the report design surface. This property allows for the customization or replacement of the toolbox service, enabling advanced scenarios such as dynamically changing the available toolbox items based on certain conditions.
Note: Setting this property with a custom implementation of IToolboxService can significantly alter the behavior and capabilities of the report designer's toolbox. It should be done with understanding of the underlying mechanics and implications.
This example illustrates how to add a Designer component and a Toolbox to a Windows Forms application, configuring the Toolbox as the Designer's toolbox.
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);
}
}
Demonstrates how to control the availability of toolbox items in the designer's toolbox.
// First, define a state provider by implementing the IToolboxUser interface. This example enables only the BandedListDesigner tool.
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) { }
}
Then, configure the toolbox with the state provider to control the enabled items.
toolbox.ConfigureToolboxItems(new ToolboxStateProvider());
This example shows how to remove a specific item from the toolbox. It demonstrates finding the item by its type name and then removing it.
private static void RemoveBandedListFromToolBox(Toolbox toolbox)
{
// Find the item to be removed by its type name.
var bandedList = toolbox.GetToolboxItems()
.OfType<ToolboxItem>()
.Single(items => items.TypeName.EndsWith("BandedListDesigner"));
// Remove the found banded list item from the toolbox.
toolbox.RemoveToolboxItem(items);
}