Share via


KeyTrigger

You can use the KeyTrigger trigger in a Windows Phone project to invoke an action based on a combination of keys pressed on the keyboard (a keyboard shortcut).

To add a KeyTrigger to a Windows Phone project

  1. In the Assets panel, click Behaviors, and then drag the behavior that you want onto the object that you want to apply the behavior to. The Trigger category appears in the Properties panel.

  2. In the Trigger category, next to TriggerType (EventTrigger), click New. In the Select Object dialog box, click KeyTrigger, and then click OK.

  3. In the FiredOn drop-down list, specify either KeyDown or KeyUp:

    • KeyDown   Triggers the behavior when the keyboard shortcut is pressed.

    • KeyUp   Triggers the behavior when the keyboard shortcut is released.

To see a sample of this behavior, visit the Expression Community Gallery Ff979317.xtlink_newWindow(en-us,Expression.40).png

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.