#1,087 – Associating a Key Binding with Multiple Modifier Keys

You define a KeyBinding object to bind a key gesture (i.e. keypress) to a particular command.  You can do this in XAML by defining a <KeyBinding> element, associating a routed command with a key “gesture”.  The gesture indicates the key that you can press in order to execute the command.

Key gestures typically require associating a key with at least one of the modifier keys (Ctrl, Alt, Shift, or Windows key).  For example, Ctrl+O is specified as:

        <KeyBinding Command="ApplicationCommands.Open"
                    Gesture="Ctrl+O"/>

You can also combine modifier keys, using the “+” symbol.

        <KeyBinding Command="ApplicationCommands.Open"
                    Gesture="Ctrl+Alt+O"/>

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

2 Responses to #1,087 – Associating a Key Binding with Multiple Modifier Keys

  1. Pingback: Dew Drop – June 5, 2014 (#1791) | Morning Dew

  2. Anjum says:

    How to assign VS2010 like keybinding like Ctrl+W,J ? That is pressing Ctrl + W and then pressing J while keeping Ctrl+W pressed to view Object browser.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: