

If (Modifiers.HasFlag(ModifierKeys.Windows))Īn instance of this class is created by specifying a key along with a combination of modifiers (if any) that need to be pressed to execute a shortcut. If (Modifiers.HasFlag(ModifierKeys.Shift))

If (Modifiers.HasFlag(ModifierKeys.Control)) Public Hotkey(Key key, ModifierKeys modifiers) Let's make a class that encapsulates the values of those enums and call it Hotkey. WPF has two useful enumerations for this task - and. Such control doesn't come out of the box with WPF, but we can implement it ourselves. GUI applications sometimes offer a way for users to configure hotkeys, typically using a textbox that records combination of key presses inside it.
