InputBinding コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
InputBinding クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| InputBinding() |
InputBindingから派生したクラスの基本初期化を提供します。 |
| InputBinding(ICommand, InputGesture) |
指定したコマンドと入力ジェスチャを使用して、 InputBinding クラスの新しいインスタンスを初期化します。 |
InputBinding()
InputBindingから派生したクラスの基本初期化を提供します。
protected:
InputBinding();
protected InputBinding();
Protected Sub New ()
注釈
InputBinding は技術的には抽象クラスではありませんが、パラメーターなしのコンストラクターは意図的に保護されたアクセスです。 これは、 InputBinding を XAML の "抽象" クラスにする効果があります。 WPFには、InputBinding 型のオブジェクトを想定する XAML 使用法を持つ既存のプロパティがありますが、XAML で InputBinding インスタンスを指定することはできません。 代わりに、InputBindingやKeyBindingなど、デバイス固有の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 または gesture が null。
例
次の例では、このコンストラクターを使用して KeyGesture を RoutedCommandに関連付ける方法を示します。
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)
注釈
既存の入力バインディング クラスを使用するソフトウェア開発者の場合、カスタム コマンドを定義している場合でも、通常はこのコンストラクターを使用しません。 代わりに、派生クラスのコンストラクター (KeyBinding と MouseBinding) を使用するか、カスタム クラスの基本インスタンス化としてこのコンストラクターを使用します。 InputBinding クラスでは、原則としてさまざまな入力デバイスがサポートされていますが、実際には、入力バインディングが表すデバイスを選択する必要があります。 入力バインディングで設定できる Gesture 値は 1 つだけで、ジェスチャはデバイス固有です。