Class ToolboxControl
- Namespace
- Alternet.FormDesigner.Wpf.Toolbox
- Assembly
- Alternet.FormDesigner.Wpf.v10.dll
Displays and manipulates list of icons for components and controls that user can place onto design surface
[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
- Inheritance
-
ToolboxControl
- Implements
- Extension Methods
Examples
Here is how to declare a ToolboxControl and handle its events from the C# code:
using Alternet.FormDesigner.Wpf;
using Alternet.FormDesigner.Wpf.Toolbox;
using System;
public partial class MainWindow : Window
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var formDesigner = new FormDesignerControl();
formDesigner.AutoSaveToSource = false;
var toolboxControl = new ToolboxControl();
toolboxControl.FormDesigner = formDesigner;
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:
Imports Alternet.FormDesigner.Wpf
Imports Alternet.FormDesigner.Wpf.Toolbox
Imports System
Partial Public Class MainWindow
Inherits Window
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim formDesigner = New FormDesignerControl()
formDesigner.AutoSaveToSource = False
Dim toolboxControl = New ToolboxControl()
toolboxControl.FormDesigner = formDesigner
AddHandler toolboxControl.FormDesignerChanged, AddressOf ToolboxControl_FormDesignerChanged
End Sub
Private Sub ToolboxControl_FormDesignerChanged(ByVal sender As Object, ByVal e As EventArgs)
Windows.MessageBox.Show("Designer changed")
End Sub
End Class
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.
Constructors
- ToolboxControl()
Initializes a new instance of the
ToolboxControl
class with default settings.
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
IFormDesignerControl
bound to this toolbox.
- HideContentsWhenNoFormDesignerIsSet
Gets or sets a value indicating whether toolbox content should be hidden if designer is not set.
- SearchEnabled
Gets or sets a value indicating whether the search feature is enabled in the Toolbox control.
- SearchFilter
Gets or sets a string that is a filter of the toolbox items that appear.
- 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.
- 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.
- EditCategory(string)
Starts to edit the specified category.
- EditItem(string)
Starts to edit the specified toolbx item.
- EndUpdate()
Re-enables toolbox repainting.
- FillWithStandardItems()
Fills ToolboxControl with standard items.
- GetAllTools()
Gets all toolbox items.
- 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, int)
Moves category to its current position plus value specified by positionDifference parameter.
- MoveItem(string, ToolboxItem, int)
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)
Invoked when an unhandled System.Windows.Input.Keyboard.PreviewKeyDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
- OnPreviewMouseRightButtonUp(MouseButtonEventArgs)
Invoked when an unhandled PreviewMouseRightButtonUp routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
- 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, bool)
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
This event is raised when some properties of the Toolbox control change.