Table of Contents

Class EventTriggerBase

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

Represents a trigger that can listen to an object other than its AssociatedObject.

public abstract class EventTriggerBase : TriggerBase, IAnimatable, IAttachedObject
Inheritance
EventTriggerBase
Implements
Derived
Inherited Members
Extension Methods

Remarks

This is an infrastructure class. Trigger authors should derive from EventTriggerBase<T> instead of this class.

Fields

SourceNameProperty

public static readonly DependencyProperty SourceNameProperty

Field Value

DependencyProperty

SourceObjectProperty

public static readonly DependencyProperty SourceObjectProperty

Field Value

DependencyProperty

Properties

AssociatedObjectTypeConstraint

Gets the type constraint of the associated object.

protected override sealed Type AssociatedObjectTypeConstraint { get; }

Property Value

Type

The associated object type constraint.

Remarks

Define a TypeConstraintAttribute on a derived type to constrain the types it may be attached to.

Source

Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject.

public object Source { get; }

Property Value

object

The resolved source object.

Remarks

In general, this property should be used in place of AssociatedObject in derived classes.

Exceptions

InvalidOperationException

The element pointed to by does not satisify the type constraint.

SourceName

Gets or sets the name of the element this EventTriggerBase listens for as a source. If the name is not set or cannot be resolved, the AssociatedObject will be used. This is a dependency property.

public string SourceName { get; set; }

Property Value

string

The name of the source element.

SourceObject

Gets or sets the target object. If TargetObject is not set, the target will look for the object specified by TargetName. If an element referred to by TargetName cannot be found, the target will default to the AssociatedObject. This is a dependency property.

public object SourceObject { get; set; }

Property Value

object

The target object.

SourceTypeConstraint

Gets the source type constraint.

protected Type SourceTypeConstraint { get; }

Property Value

Type

The source type constraint.

Methods

GetEventName()

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

protected abstract string GetEventName()

Returns

string

OnAttached()

Called after the trigger is attached to an AssociatedObject.

protected override void OnAttached()

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