RoutedCommand RoutedCommand RoutedCommand RoutedCommand Class

Definición

Define un comando que implementa ICommand y se enruta a través del árbol de elementos.Defines a command that implements ICommand and is routed through the element tree.

public ref class RoutedCommand : System::Windows::Input::ICommand
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public class RoutedCommand : System.Windows.Input.ICommand
type RoutedCommand = class
    interface ICommand
Public Class RoutedCommand
Implements ICommand
Herencia
RoutedCommandRoutedCommandRoutedCommandRoutedCommand
Derivado
Atributos
Implementaciones

Comentarios

Los Execute métodos CanExecute y de un RoutedCommand no contienen la lógica de la aplicación para el comando como es el caso de un ICommandtípico, pero en su lugar, estos métodos generan eventos que atraviesan el árbol de elementos buscando un objeto con un CommandBinding.The Execute and CanExecute methods on a RoutedCommand do not contain the application logic for the command as is the case with a typical ICommand, but rather, these methods raise events that traverse the element tree looking for an object with a CommandBinding. Los controladores de eventos adjuntos CommandBinding a contienen la lógica del comando.The event handlers attached to the CommandBinding contain the command logic.

El Execute método genera los PreviewExecuted eventos Executed y.The Execute method raises the PreviewExecuted and Executed events. El CanExecute método genera los PreviewCanExecute eventos CanExecute y.The CanExecute method raises the PreviewCanExecute and CanExecute events.

Uso de atributos XAMLXAML Attribute Usage

<objeto de propiedad= "predefinedCommandName"/><object property="predefinedCommandName"/>

O bien-or-

<objeto de propiedad= "predefinedClassName. predefinedCommandName"/><object property="predefinedClassName.predefinedCommandName"/>

o bien-or-

<objeto de propiedad= "{ customClassName. customCommandName} "/><object property="{ customClassName.customCommandName}"/>

Valores XAMLXAML Values

predefinedClassNamepredefinedClassName
Una de las clases de comandos predefinidas.One of the predefined command classes.

predefinedCommandNamepredefinedCommandName
Uno de los comandos predefinidos.One of the predefined commands.

customClassNamecustomClassName
Una clase personalizada que contiene el comando personalizado.A custom class which contains the custom command. Normalmente, las clases personalizadas xlmns requieren una asignación de prefijo; vea espacios de nombres y asignación de espacios de nombres XAML para WPF.Custom classes generally require an xlmns prefix mapping; see XAML Namespaces and Namespace Mapping for WPF XAML.

customCommandNamecustomCommandName
Un comando personalizado.A custom command.

Constructores

RoutedCommand() RoutedCommand() RoutedCommand() RoutedCommand()

Inicializa una nueva instancia de la clase RoutedCommand.Initializes a new instance of the RoutedCommand class.

RoutedCommand(String, Type) RoutedCommand(String, Type) RoutedCommand(String, Type) RoutedCommand(String, Type)

Inicializa una nueva instancia de la clase RoutedCommand con el nombre y el tipo de propietario especificados.Initializes a new instance of the RoutedCommand class with the specified name and owner type.

RoutedCommand(String, Type, InputGestureCollection) RoutedCommand(String, Type, InputGestureCollection) RoutedCommand(String, Type, InputGestureCollection) RoutedCommand(String, Type, InputGestureCollection)

Inicializa una nueva instancia de la clase RoutedCommand con el nombre, el tipo de propietario y la colección de gestos especificados.Initializes a new instance of the RoutedCommand class with the specified name, owner type, and collection of gestures.

Propiedades

InputGestures InputGestures InputGestures InputGestures

Obtiene la colección de objetos InputGesture asociados a este comando.Gets the collection of InputGesture objects that are associated with this command.

Name Name Name Name

Obtiene el nombre del comando.Gets the name of the command.

OwnerType OwnerType OwnerType OwnerType

Obtiene el tipo que se registra con el comando.Gets the type that is registered with the command.

Métodos

CanExecute(Object, IInputElement) CanExecute(Object, IInputElement) CanExecute(Object, IInputElement) CanExecute(Object, IInputElement)

Determina si este RoutedCommand puede ejecutarse en su estado actual.Determines whether this RoutedCommand can execute in its current state.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
Execute(Object, IInputElement) Execute(Object, IInputElement) Execute(Object, IInputElement) Execute(Object, IInputElement)

Ejecuta RoutedCommand en el destino de comando actual.Executes the RoutedCommand on the current command target.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Eventos

CanExecuteChanged CanExecuteChanged CanExecuteChanged CanExecuteChanged

Se produce cuando el administrador del comando detecta cambios en el origen del comando.Occurs when changes to the command source are detected by the command manager. Normalmente, estos cambios afectan al hecho de que el comando se ejecute en el destino de comando actual.These changes often affect whether the command should execute on the current command target.

Implementaciones de interfaz explícitas

ICommand.CanExecute(Object) ICommand.CanExecute(Object) ICommand.CanExecute(Object) ICommand.CanExecute(Object)

Para obtener una descripción de este miembro, vea CanExecute(Object).For a description of this members, see CanExecute(Object).

ICommand.Execute(Object) ICommand.Execute(Object) ICommand.Execute(Object) ICommand.Execute(Object)

Para obtener una descripción de este miembro, vea Execute(Object).For a description of this members, see Execute(Object).

Se aplica a

Consulte también: