KeyTrigger (Blend SDK for WPF)

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

To add a KeyTrigger

  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.

    KeyTrigger

  3. In the Trigger category, in the SourceObject box, select the element that you want to define a keyboard shortcut for. By default, the SourceObject is the element that contains an action. You can use the **Artboard Element Picker **Artboard Element Picker icon to select the element that you want directly on the artboard.

  4. 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.