InputBindingCollection.Add(InputBinding) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Ajoute le InputBinding spécifié à ce InputBindingCollection.
public:
int Add(System::Windows::Input::InputBinding ^ inputBinding);
public int Add (System.Windows.Input.InputBinding inputBinding);
member this.Add : System.Windows.Input.InputBinding -> int
Public Function Add (inputBinding As InputBinding) As Integer
Paramètres
- inputBinding
- InputBinding
Liaison à ajouter à la collection.
Retours
Retourne toujours 0. Cela s'éloigne de l'implémentation IList standard pour Add
, qui doit retourner l'index dans lequel le nouvel élément a été ajouté à la collection.
Exceptions
inputBinding
a la valeur null
.
Exemples
L’exemple suivant crée un KeyGesture et l’associe à un KeyBinding. est KeyBinding ajouté à sur InputBindingCollection un Window.
<Window.InputBindings>
<KeyBinding Key="B"
Modifiers="Control"
Command="ApplicationCommands.Open" />
</Window.InputBindings>
KeyGesture OpenKeyGesture = new KeyGesture(
Key.B,
ModifierKeys.Control);
KeyBinding OpenCmdKeybinding = new KeyBinding(
ApplicationCommands.Open,
OpenKeyGesture);
this.InputBindings.Add(OpenCmdKeybinding);
Dim OpenKeyGesture As New KeyGesture(Key.B, ModifierKeys.Control)
Dim OpenCmdKeybinding As New KeyBinding(ApplicationCommands.Open, OpenKeyGesture)
Me.InputBindings.Add(OpenCmdKeybinding)
L’exemple XAML n’utilise Addpas littéralement , mais Add est appelé implicitement par la prise en charge du traitement XAML pour les collections. Pour plus d’informations sur XAML et les collections, consultez Vue d’ensemble de XAML (WPF).
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour