InputGestureCollection.Add(InputGesture) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Adiciona o especificado InputGesture a este 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
Parâmetros
- inputGesture
- InputGesture
O gesto para acrescentar à coleção.
Devoluções
0, se a operação tiver sido bem-sucedida (note-se que este não é o índice do item adicionado).
Exceções
A coleção é só de leitura.
O gesto é null.
Exemplos
O exemplo seguinte cria um KeyGesture e adiciona-o ao InputGestureCollection de um 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)