Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
With the exception of the function keys and the numeric keypad keys, a KeyGesture must contain a Key and one or more ModifierKeys. Function keys and numeric keypad keys do not require a modifier key in order to be a valid KeyGesture.
When defining a KeyBinding in Extensible Application Markup Language (XAML) there are two ways to specify the KeyGesture. The first is to define the Key and the Modifiers attributes of the KeyBinding element. The second way to create a KeyBinding in XAML is to define the Gesture attribute of the KeyBinding element. Both ways of setting the KeyGesture are equivalent and modify the same underlying object, but there will be a conflict if both are used. In the case when the Key, Modifiers, and the Gesture attributes are set, the attribute which is defined last will be used for the KeyGesture.
The following example creates a KeyBinding and adds it to the InputBindingCollection of the root window.
<Window.InputBindings> <KeyBinding Command="ApplicationCommands.Open" Gesture="CTRL+R" /> </Window.InputBindings>
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.