Andrey,
I didn't need to specifally get a Toolbox item. My ToolboxService derived class contained an array of toolbox items, in their appropriate toolbox item container. This was populated in the ctor as in:
uiToolboxItems.Add(new ToolboxItemContainer(new ToolboxItem(typeof(Label))));
uiToolboxItems.Add(new ToolboxItemContainer(new ToolboxItem(typeof(Button))));
uiToolboxItems.Add(new ToolboxItemContainer(new ToolboxItem(typeof(TextBox))));
uiToolboxItems.Add(new ToolboxItemContainer(new ToolboxItem(typeof(TabControl))));
And then when I needed to populate my tree view of toolbox item controls I used:
ToolboxItemCollection tools = toolboxService.GetToolboxItems(categoryName);
foreach (ToolboxItem toolItem in tools)
{
...
<Create tree node and add toolItem reference to the Tag
...
}
And then, during a mouse down handler on the tree view I initiated the drag operation with the toolbox item like...
ToolboxItem item = clickedNode.Tag as ToolboxItem;
// if its not the pointer tool
if (string.Compare(item.DisplayName, "Pointer", true) != 0)
{
// serialize the item and send it over
DataObject dataObj = toolboxService.SerializeToolboxItem(item) as DataObject;
DoDragDrop(dataObj, DragDropEffects.Copy);
}
Hope this helps.
Graham