InputGestureCollection.Add(InputGesture) メソッド

定義

指定した InputGesture をこの 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

パラメーター

inputGesture
InputGesture

コレクションに追加するジェスチャ。

返品

操作が成功した場合は 0 (追加された項目のインデックスではないことに注意してください)。

例外

コレクションは読み取り専用です。

ジェスチャが null

次の例では、KeyGestureを作成し、InputGestureCollectionRoutedCommandに追加します。

<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)

適用対象

こちらもご覧ください