ToolboxControl Class
Definition
Displays and manipulates list of icons for components and controls that user can place onto design surface
Inheritance
Implements
Syntax
[TemplatePart(Name = "PART_TreeView", Type = typeof(TreeView))]
[TemplatePart(Name = "PART_SearchTextBox", Type = typeof(TextBox))]
[TemplatePart(Name = "PART_FocusSearchButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_ClearSearchButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_NoResultsFoundMessage", Type = typeof(Grid))]
public class ToolboxControl : Control, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IToolboxControl, INotifyPropertyChanged
Remarks
The ToolboxControl control displays a list of controls and other items you can add to the designed form. It can be linked to FormDesignerControl by setting the FormDesigner property, which allows dragging components and controls to the Form Designer.
The most important properties of the WPF Toolbox are:
CategoryNames � gets a collection of Categories (Tabs) displayed by the Toolbox.
SelectedCategory � returns the currently selected toolbox category.
SelectedToolboxItem � returns the currently selected Toolbox item.
Here are some of the essential features provided by the WPF Toolbox:
- Add and remove a new category from the Toolbox.
- Add and remove toolbox items from the specified toolbox tab.
- Load and save toolbox content.
Set the FormDesignerControl property to specify the Form Designer control associated with the Toolbox control.
Examples
Here is how to declare a ToolboxControl and handle its events from the C# code:
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
var toolboxControl = new Alternet.FormDesigner.Wpf.Toolbox.ToolboxControl();
toolboxControl.FormDesigner = designer;
toolboxControl.FormDesignerChanged += ToolboxControl_FormDesignerChanged;
}
private void ToolboxControl_FormDesignerChanged(object sender, EventArgs e)
{
System.Windows.MessageBox.Show("Designer changed");
}
}
Here is how to declare a ToolboxControl and handle its events from the Visual Basic code:
Partial Public Class Form1
Inherits Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim toolboxControl = New Alternet.FormDesigner.Wpf.Toolbox.ToolboxControl()
toolboxControl.FormDesigner = designer
AddHandler toolboxControl.FormDesignerChanged, AddressOf ToolboxControl_FormDesignerChanged
End Sub
Private Sub ToolboxControl_FormDesignerChanged(ByVal sender As Object, ByVal e As EventArgs)
System.Windows.MessageBox.Show("Designer changed")
End Sub
End Class
Constructors
ToolboxControl() | Initializes a new instance of the |
Fields
FormDesignerProperty | Identifies the FormDesigner dependency property. |
Properties
AutoFillWithStandardItems | Gets or sets a boolean value indicating whether ToolboxControl content should be automatically filled by the collection of the standard toolbox items. |
Categories | Gets an ObservableCollection of Categories (Tabs) displayed by the toolbox. |
CategoryNames | Gets collection of Categories (Tabs) displayed by the toolbox. |
Control | Gets a control implementing the toolbox. |
FormDesigner | Gets or sets |
HideContentsWhenNoFormDesignerIsSet | Gets or sets a value indicating whether toolbox content should be hidden if designer is not set. |
SearchEnabled | |
SearchFilter | |
SelectedCategory | Gets or sets currently selected toolbox category. |
SelectedToolboxItem | Returns currently selected toolbox item. |
Methods
AddCategory(String) | Adds new category to the toolbox. |
AddItem(String, ToolboxItem) | Places toolbox item onto specified toolbox tab. |
AddItemForType(String, Type, ImageSource) | Adds toolbox item from type name. |
AddItemsFromAssembly(String, Assembly) | Add all types that can appear on the toolbox from the assembly. |
BeginUpdate() | Prevents repainting of the toolbox until EndUpdate is called. |
Clear() | Deletes all tabs and items from the toolbox. |
ClearItemsInCategory(String) | Clears items in the specified tab. |
CreateContextMenu() | |
CreateDefaultToolServiceProvider() | |
CreateItemTool(ToolboxItem) | |
CreateSerialization() | |
DoesCategoryExist(String) | Identifies whether given category exist in the IToolboxControl. |
DoesItemExist(String, ToolboxItem) | Identifies whether given item exist in the specified tab. |
DoesItemExist(String, String) | Identifies whether given item exist in the specified tab. |
EndUpdate() | Re-enables toolbox repainting. |
FillWithStandardItems() | Fills ToolboxControl with standard items. |
GetAllTools() | Gets all toolbox items. |
GetServiceProvider() | |
GetToolsFromCategory(String) | Gets toolbox items on the specified tab. |
IsCategoryCollapsed(String) | Indicates whether specified category is in the collapsed state. |
Load(Stream) | Loads the toolbox content from the specified stream. |
MoveCategory(String, Int32) | Moves category to its current position plus value specified by positionDifference parameter. |
MoveItem(String, ToolboxItem, Int32) | Moves item to its current position plus value specified by positionDifference parameter. |
OnApplyTemplate() | Is invoked whenever application code or internal processes call System.Windows.FrameworkElement.ApplyTemplate. |
OnPreviewKeyDown(KeyEventArgs) | |
OnPreviewMouseRightButtonUp(MouseButtonEventArgs) | |
OnPropertyChanged(String) | |
RemoveAllCategories() | Removes all categories from the toolbox control. |
RemoveCategory(String) | Removes specified tab. |
RemoveItem(String, ToolboxItem) | Removes toolbox item from the category. |
RenameCategory(String, String) | Renames the specified category. |
Reset() | Resets the toolbox content to defaults. |
Save(Stream) | Saves the toolbox content to the specified stream. |
SelectPointer() | Deselects currently selected toolbox item and selects pointer tool. |
SetCategoryCollapsed(String, Boolean) | Sets specified collapsed state to the given category. |
SetSelectedItem(String, ToolboxItem) | Selects toolbox item. |
Events
FormDesignerChanged | Occurs when the value of FormDesigner property are changed. |
PropertyChanged |