MouseGesture MouseGesture MouseGesture MouseGesture Class

Definición

Define un gesto de entrada del mouse que se puede utilizar para invocar un comando.Defines a mouse input gesture that can be used to invoke a command.

public ref class MouseGesture : System::Windows::Input::InputGesture
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.MouseGestureConverter))]
public class MouseGesture : System.Windows.Input.InputGesture
type MouseGesture = class
    inherit InputGesture
Public Class MouseGesture
Inherits InputGesture
Herencia
MouseGestureMouseGestureMouseGestureMouseGesture
Atributos

Ejemplos

En el ejemplo siguiente se muestra cómo MouseGesture crear y asociarlo RoutedCommand a a través MouseBindingde.The following example shows to create a MouseGesture and associate it with a RoutedCommand through a MouseBinding. Cuando se hace clic en la rueda del mouse Control mientras se presiona la tecla Open , se invoca a.When the mouse wheel is clicked while the Control key is pressed, the Open is invoked.

<MouseBinding Gesture="Control+WheelClick"
              Command="ApplicationCommands.Open" />
MouseGesture OpenCmdMouseGesture = new MouseGesture();
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick;
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control;

MouseBinding OpenCmdMouseBinding = new MouseBinding();
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture;
OpenCmdMouseBinding.Command = ApplicationCommands.Open;

this.InputBindings.Add(OpenCmdMouseBinding);
Dim OpenCmdMouseGesture As New MouseGesture()
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control

Dim OpenCmdMouseBinding As New MouseBinding()
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture
OpenCmdMouseBinding.Command = ApplicationCommands.Open

Me.InputBindings.Add(OpenCmdMouseBinding)

Comentarios

A diferencia de KeyGesture, un MouseAction no tiene que emparejarse con ModifierKeys para ser un válido MouseGesture.Unlike a KeyGesture, a MouseAction does not have to be paired with ModifierKeys to be a valid MouseGesture.

Un MouseGesture se puede enlazar a RoutedCommand un (u ICommand otras implementaciones) a MouseBinding través de para que se invoque el comando MouseGesture cuando se produce.A MouseGesture can be bound to a RoutedCommand (or other ICommand implementations) through a MouseBinding so that the command is invoked when the MouseGesture occurs.

En MouseGesture el caso de XAMLXAML los usos de atributo, la propiedad que XAMLXAML se Gestureestablece normalmente en es, en los casos en que el gesto puede representar una acción del mouse y una o más tecla modificadora.For MouseGesture XAMLXAML attribute usages, the property that is generally set in XAMLXAML is Gesture, in cases where the gesture can represent both a mouse action and one or more modifier key. También puede establecer la Gesture propiedad para que sea simplemente una acción del mouse.You can also set the Gesture property to be just a mouse action. En general, se recomienda usar solo el atributo de Gesture XAMLXAML, en lugar de la configuración MouseActionde, incluso si no se especifican modificadores.In general, it is recommended that you use only the Gesture attribute from XAMLXAML, rather than setting MouseAction, even if you do not specify modifiers. Esto evitará la ambigüedad, proporciona la sintaxis más optimizada y proporciona la representación más directa para la serialización.This will avoid ambiguity, provides the most streamlined syntax, and provides the most straightforward representation for serialization.

MouseGesturelos usos de los elementos de objeto son posibles pero poco frecuentes, ya que normalmente se Gesture puede establecer MouseBinding la propiedad de insertada sin el uso de la sintaxis de elementos de propiedad. XAMLXAMLMouseGesture XAMLXAML object element usages are possible but uncommon, because you can ordinarily set the Gesture property of MouseBinding inline without the use of property element syntax.

Uso de atributos XAMLXAML Attribute Usage

<object property="mouseAction"/>  
- or -  
<object property="oneOrMoreModifierKeys+mouseAction"/>  

Valores XAMLXAML Values

mouseAction
MouseAction

Una única acción del mouse.A single mouse action.

oneOrMoreModifierKeys
Una o más teclas modificadoras, definidas por la ModifierKeys enumeración.One or more modifier keys, defined by the ModifierKeys enumeration. Si se proporciona más de una tecla modificadora, cada tecla modificadora se delimita con un carácter "+".If more than one modifier key is provided, each modifier key is delimited with a "+" character.

Constructores

MouseGesture() MouseGesture() MouseGesture() MouseGesture()

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

MouseGesture(MouseAction) MouseGesture(MouseAction) MouseGesture(MouseAction) MouseGesture(MouseAction)

Inicializa una nueva instancia de la clase MouseGesture utilizando la clase MouseAction especificada.Initializes a new instance of the MouseGesture class using the specified MouseAction.

MouseGesture(MouseAction, ModifierKeys) MouseGesture(MouseAction, ModifierKeys) MouseGesture(MouseAction, ModifierKeys) MouseGesture(MouseAction, ModifierKeys)

Inicializa una nueva instancia de la clase MouseGesture utilizando los objetos MouseAction y ModifierKeys especificados.Initializes a new instance of the MouseGesture class using the specified MouseAction and ModifierKeys.

Propiedades

Modifiers Modifiers Modifiers Modifiers

Obtiene o establece las teclas modificadoras asociadas a este objeto MouseGesture.Gets or sets the modifier keys associated with this MouseGesture.

MouseAction MouseAction MouseAction MouseAction

Obtiene o establece la MouseAction asociada a este gesto.Gets or sets the MouseAction associated with this gesture.

Métodos

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)
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)
Matches(Object, InputEventArgs) Matches(Object, InputEventArgs) Matches(Object, InputEventArgs) Matches(Object, InputEventArgs)

Determina si MouseGesture coincide con la entrada asociada al objeto InputEventArgs especificado.Determines whether MouseGesture matches the input associated with the specified InputEventArgs 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)

Se aplica a

Consulte también: