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)

적용 대상

추가 정보