Class KeyTrigger
A Trigger that is triggered by a keyboard event. If the target Key and Modifiers are detected, it fires.
public class KeyTrigger : EventTriggerBase<UIElement>, IAnimatable, IAttachedObject
- Inheritance
-
KeyTrigger
- Implements
- Inherited Members
- Extension Methods
Fields
ActiveOnFocusProperty
public static readonly DependencyProperty ActiveOnFocusProperty
Field Value
FiredOnProperty
public static readonly DependencyProperty FiredOnProperty
Field Value
KeyProperty
public static readonly DependencyProperty KeyProperty
Field Value
ModifiersProperty
public static readonly DependencyProperty ModifiersProperty
Field Value
Properties
ActiveOnFocus
If true, the Trigger only listens to its trigger Source object, which means that element must have focus for the trigger to fire. If false, the Trigger listens at the root, so any unhandled KeyDown/Up messages will be caught.
public bool ActiveOnFocus { get; set; }
Property Value
FiredOn
Determines whether or not to listen to the KeyDown or KeyUp event.
public KeyTriggerFiredOn FiredOn { get; set; }
Property Value
Key
The key that must be pressed for the trigger to fire.
public Key Key { get; set; }
Property Value
Modifiers
The modifiers that must be active for the trigger to fire (the default is no modifiers pressed).
public ModifierKeys Modifiers { get; set; }
Property Value
Methods
GetEventName()
Specifies the name of the Event this EventTriggerBase is listening for.
protected override string GetEventName()
Returns
OnDetaching()
Called when the trigger is being detached from its AssociatedObject, but before it has actually occurred.
protected override void OnDetaching()
OnEvent(EventArgs)
Called when the event associated with this EventTriggerBase is fired. By default, this will invoke all actions on the trigger.
protected override void OnEvent(EventArgs eventArgs)
Parameters
Remarks
Override this to provide more granular control over when actions associated with this trigger will be invoked.