英語で読む

次の方法で共有


ModifierKeys 列挙型

定義

変換キーのセットを指定します。

この列挙体は、メンバー値のビットごとの組み合わせをサポートしています。

C#
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.ModifierKeysConverter))]
[System.Flags]
public enum ModifierKeys
継承
ModifierKeys
属性

フィールド

名前 説明
Alt 1

Alt キー。

Control 2

CTRL キー

None 0

どの変換キーも押されていません。

Shift 4

Shift キー

Windows 8

Windows ロゴ キー

次の例では、 を に関連付ける を KeyBinding 作成する KeyGesture 方法を RoutedCommand示します。 では KeyBinding 、 列挙を ModifierKeys 使用してジェスチャの修飾子キーを指定します。

XAML
<Window.InputBindings>
  <KeyBinding Command="ApplicationCommands.Open"
              Gesture="CTRL+R" />
</Window.InputBindings>
C#
// Creating a KeyBinding between the Open command and Ctrl-R
KeyBinding OpenCmdKeyBinding = new KeyBinding(
    ApplicationCommands.Open, 
    Key.R, 
    ModifierKeys.Control);

this.InputBindings.Add(OpenCmdKeyBinding);

注釈

クラスの Keyboard プロパティはModifiers、現在押されている修飾子キーのセットです。

列挙体を使用する Windows Presentation Foundation (WPF) の一部の ModifierKeys API はModifiers、および MouseGesture クラスのKeyboardKeyBindingKeyGestureプロパティです。

XAML 属性の使用方法

<object property="oneOrMoreModifierKeys"/>  

XAML 値

oneOrMoreModifierKeys
列挙体によって定義される 1 つ以上の ModifierKeys 修飾子キーは、"+" 文字で区切られます。

適用対象

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください