ToolCommand Class

Acts as a command identifier and as a unified way of invoking a particular command.

Inheritance Hierarchy

System.Object
  Microsoft.Windows.Design.Interaction.ToolCommand

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

Syntax

'Declaration
Public Class ToolCommand _
    Implements ICommand
public class ToolCommand : ICommand
public ref class ToolCommand : ICommand
type ToolCommand =  
    class
        interface ICommand
    end
public class ToolCommand implements ICommand

The ToolCommand type exposes the following members.

Constructors

  Name Description
Public method ToolCommand() Initializes a new instance of the ToolCommand class.
Public method ToolCommand(String) Initializes a new instance of the ToolCommand class with the specified command name.

Top

Properties

  Name Description
Public property Name Gets the name of this command.

Top

Methods

  Name Description
Public method CanExecute Locates a command binding for the command and asks if it is enabled.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public method Execute Locates a command binding for the command and executes it.
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.)
Public method ToString Returns the name of this command. (Overrides Object.ToString().)

Top

Events

  Name Description
Public event CanExecuteChanged Occurs when the status of this command changes.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method ICommand.CanExecute For a description of this member, see ICommand.CanExecute.
Explicit interface implemetationPrivate method ICommand.Execute For a description of this member, see ICommand.Execute.

Top

Remarks

The ToolCommand class is similar to the RoutedCommand class in Windows Presentation Foundation (WPF). When the Execute or CanExecute method is called, the binding tree is searched for command bindings that are bound to this command. The event handlers specified by the command bindings are then executed.

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

Understanding WPF Designer Extensibility