Table of Contents

Class KeyTrigger

Namespace
HeBianGu.Base.WpfBase
Assembly
HeBianGu.Base.WpfBase.dll

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

DependencyProperty

FiredOnProperty

public static readonly DependencyProperty FiredOnProperty

Field Value

DependencyProperty

KeyProperty

public static readonly DependencyProperty KeyProperty

Field Value

DependencyProperty

ModifiersProperty

public static readonly DependencyProperty ModifiersProperty

Field Value

DependencyProperty

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

bool

FiredOn

Determines whether or not to listen to the KeyDown or KeyUp event.

public KeyTriggerFiredOn FiredOn { get; set; }

Property Value

KeyTriggerFiredOn

Key

The key that must be pressed for the trigger to fire.

public Key Key { get; set; }

Property Value

Key

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

ModifierKeys

Methods

GetEventName()

Specifies the name of the Event this EventTriggerBase is listening for.

protected override string GetEventName()

Returns

string

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

eventArgs EventArgs

The EventArgs instance containing the event data.

Remarks

Override this to provide more granular control over when actions associated with this trigger will be invoked.