InputBinding.Command 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 입력 바인딩과 연결된 값을 가져오거나 설정합니다 ICommand .
public:
property System::Windows::Input::ICommand ^ Command { System::Windows::Input::ICommand ^ get(); void set(System::Windows::Input::ICommand ^ value); };
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
public System.Windows.Input.ICommand Command { get; [System.Security.SecurityCritical] set; }
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
[System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public System.Windows.Input.ICommand Command { get; set; }
[<System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)>]
[<set: System.Security.SecurityCritical>]
member this.Command : System.Windows.Input.ICommand with get, set
[<System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)>]
[<System.ComponentModel.TypeConverter("System.Windows.Input.CommandConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")>]
member this.Command : System.Windows.Input.ICommand with get, set
Public Property Command As ICommand
속성 값
연결된 명령입니다.
- 특성
예외
Command 값은 null.
예제
다음 예제에서는 명령에 바인딩 KeyBindingKeyGesture 하는 ApplicationCommands.Open 데 사용하는 방법을 보여줍니다. 키 제스처가 수행되면 Open 명령이 호출됩니다.
<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)
설명
클래스는 InputBinding 공용 매개 변수가 없는 생성자를 노출하지 않으므로 XAML 사용을 지원하지 않습니다(매개 변수가 없는 생성자는 있지만 보호됨). 그러나 파생 클래스는 공용 생성자를 노출할 수 있으므로 상속된 InputBinding속성을 사용할 수 있습니다. XAML에서 인스턴스화할 수 있고 XAML 사용으로 속성을 설정할 수 있는 두 개의 기존 InputBinding 파생 클래스는 다음과 MouseBinding같습니다KeyBinding.
ICommand 는 특정 기존 ICommand 구현에서 문자열 형식의 값을 지정할 수 있도록 하는 형식 변환기를 참조합니다. 이 형식 변환 동작은 이 속성의 특성 값 형식을 설정합니다. 개체에 Command정의된 속성에 , CommandParameter및 CommandTarget 속성을 바인딩할 ICommand 수도 있습니다. 이렇게 하면 사용자 지정 명령을 정의하고 사용자 입력과 연결할 수 있습니다. 자세한 내용은 두 번째 예제를 참조하세요 InputBinding.
XAML 특성 사용
<
inputBindingDerivedClass
Command="ICommand"/>
XAML 속성 요소 사용
<inputBindingDerivedClass>
<inputBindingDerivedClass.Command>
<iCommandImplementation/>
</inputBindingDerivedClass.Command>
</inputBindingDerivedClass>
XAML 값
inputBindingDerivedClass개체 요소 구문(예: InputBinding 또는 KeyBinding.)을 지원하는 파생 클래스 MouseBinding 입니다. 비고를 참조하세요.
iCommandImplementation 개체 요소 구문을 지원하는 개체 구현 ICommand 입니다(공용 매개 변수가 없는 생성자 포함).