InputBinding コンストラクター

定義

InputBinding クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
InputBinding()

InputBindingから派生したクラスの基本初期化を提供します。

InputBinding(ICommand, InputGesture)

指定したコマンドと入力ジェスチャを使用して、 InputBinding クラスの新しいインスタンスを初期化します。

InputBinding()

InputBindingから派生したクラスの基本初期化を提供します。

protected:
 InputBinding();
protected InputBinding();
Protected Sub New ()

注釈

InputBinding は技術的には抽象クラスではありませんが、パラメーターなしのコンストラクターは意図的に保護されたアクセスです。 これは、 InputBinding を XAML の "抽象" クラスにする効果があります。 WPFには、InputBinding 型のオブジェクトを想定する XAML 使用法を持つ既存のプロパティがありますが、XAML で InputBinding インスタンスを指定することはできません。 代わりに、InputBindingKeyBindingなど、デバイス固有のMouseBinding派生クラスのいずれかを値として指定できます。

注意 (継承者)

XAML の使用をサポートするカスタム InputBinding を実装する場合は、基本初期化にこのコンストラクターを使用します。

適用対象

InputBinding(ICommand, InputGesture)

指定したコマンドと入力ジェスチャを使用して、 InputBinding クラスの新しいインスタンスを初期化します。

public:
 InputBinding(System::Windows::Input::ICommand ^ command, System::Windows::Input::InputGesture ^ gesture);
[System.Security.SecurityCritical]
public InputBinding(System.Windows.Input.ICommand command, System.Windows.Input.InputGesture gesture);
public InputBinding(System.Windows.Input.ICommand command, System.Windows.Input.InputGesture gesture);
[<System.Security.SecurityCritical>]
new System.Windows.Input.InputBinding : System.Windows.Input.ICommand * System.Windows.Input.InputGesture -> System.Windows.Input.InputBinding
new System.Windows.Input.InputBinding : System.Windows.Input.ICommand * System.Windows.Input.InputGesture -> System.Windows.Input.InputBinding
Public Sub New (command As ICommand, gesture As InputGesture)

パラメーター

command
ICommand

gestureに関連付けるコマンド。

gesture
InputGesture

commandに関連付ける入力ジェスチャ。

属性

例外

command または gesturenull

次の例では、このコンストラクターを使用して KeyGestureRoutedCommandに関連付ける方法を示します。

KeyGesture HelpCmdKeyGesture = new KeyGesture(Key.H,
    ModifierKeys.Alt);

InputBinding inputBinding;
inputBinding = new InputBinding(ApplicationCommands.Help,
    HelpCmdKeyGesture);

this.InputBindings.Add(inputBinding);
Dim HelpCmdKeyGesture As New KeyGesture(Key.H, ModifierKeys.Alt)

Dim inputBinding As InputBinding
inputBinding = New InputBinding(ApplicationCommands.Help, HelpCmdKeyGesture)

Me.InputBindings.Add(inputBinding)

注釈

既存の入力バインディング クラスを使用するソフトウェア開発者の場合、カスタム コマンドを定義している場合でも、通常はこのコンストラクターを使用しません。 代わりに、派生クラスのコンストラクター (KeyBindingMouseBinding) を使用するか、カスタム クラスの基本インスタンス化としてこのコンストラクターを使用します。 InputBinding クラスでは、原則としてさまざまな入力デバイスがサポートされていますが、実際には、入力バインディングが表すデバイスを選択する必要があります。 入力バインディングで設定できる Gesture 値は 1 つだけで、ジェスチャはデバイス固有です。

適用対象