This documentation is archived and is not being maintained.

Tool Class

Represents a tool that determines the mode of the designer.

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

public class Tool : ContextItem

The Tool type exposes the following members.

Public methodToolInitializes a new instance of the Tool class.

Protected propertyContextGets the editing context for code within the tool.
Public propertyCursorGets or sets the default cursor for the mouse.
Public propertyFocusedTaskGets the currently focused task, if one exists.
Public propertyItemTypeGets the type of the tool. (Overrides ContextItem.ItemType.)
Public propertyTasksGets the set of tasks this tool provides.

Public methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnActivateCalled when a tool is activated.
Protected methodOnDeactivateCalled when a tool is being deactivated.
Protected methodOnItemChangedAdds activate and deactivate semantics to the Tool class. (Overrides ContextItem.OnItemChanged(EditingContext, ContextItem).)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

All user input flows through the currently active tool. To activate a tool, you set it into the editing context's ContextItemManager class. You may also handle change notifications on the ContextItemManager to know when the active tool changes. When user input comes into the designer view, the designer view locates the active tool in the editing context and asks it to resolve the user input into a command binding. The resulting command binding is then invoked.

A tool is composed of a collection of tasks, which are represented by the Task class. Each task contains a collection of commands that may be invoked, and a collection of input bindings that activate those commands. Tools may also use hit testing logic to discover tasks offered by adorners.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.