Поделиться через


Tool Class

Represents a tool that determines the mode of the designer.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.ContextItem
    Microsoft.Windows.Design.Interaction.Tool
      Microsoft.Windows.Design.Interaction.CreationTool
      Microsoft.Windows.Design.Interaction.SelectionTool

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

Syntax

'Declaration
Public Class Tool _
    Inherits ContextItem
public class Tool : ContextItem
public ref class Tool : public ContextItem
type Tool =  
    class
        inherit ContextItem
    end
public class Tool extends ContextItem

The Tool type exposes the following members.

Constructors

  Name Description
Public method Tool Initializes a new instance of the Tool class.

Top

Properties

  Name Description
Protected property Context Gets the editing context for code within the tool.
Public property Cursor Gets or sets the default cursor for the mouse.
Public property FocusedTask Gets the currently focused task, if one exists.
Public property ItemType Gets the type of the tool. (Overrides ContextItem.ItemType.)
Public property Tasks Gets the set of tasks this tool provides.

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnActivate Called when a tool is activated.
Protected method OnDeactivate Called when a tool is being deactivated.
Protected method OnItemChanged Adds activate and deactivate semantics to the Tool class. (Overrides ContextItem.OnItemChanged(EditingContext, ContextItem).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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.

Thread Safety

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

See Also

Reference

Microsoft.Windows.Design.Interaction Namespace

Other Resources

Tool Architecture

WPF Designer Extensibility Architecture