InputGestureCollection.Add(InputGesture) Méthode

Définition

Ajoute le InputGesture spécifié à ce InputGestureCollection.

public:
 int Add(System::Windows::Input::InputGesture ^ inputGesture);
public int Add (System.Windows.Input.InputGesture inputGesture);
member this.Add : System.Windows.Input.InputGesture -> int
Public Function Add (inputGesture As InputGesture) As Integer

Paramètres

inputGesture
InputGesture

Mouvement à ajouter à la collection.

Retours

0 si l’opération a abouti (notez qu’il ne s’agit pas de l’index de l’élément ajouté).

Exceptions

La collection est en lecture seule.

Le mouvement est null.

Exemples

L’exemple suivant crée un KeyGesture et l’ajoute InputGestureCollection au d’un RoutedCommand.

<Window.InputBindings>
  <KeyBinding Key="B"
              Modifiers="Control" 
              Command="ApplicationCommands.Open" />
</Window.InputBindings>
KeyGesture OpenCmdKeyGesture = new KeyGesture(
    Key.B,
    ModifierKeys.Control);

ApplicationCommands.Open.InputGestures.Add(OpenCmdKeyGesture);
Dim OpenCmdKeyGesture As New KeyGesture(Key.B, ModifierKeys.Control)

ApplicationCommands.Open.InputGestures.Add(OpenCmdKeyGesture)

S’applique à

Voir aussi