Class EventTriggerBase<T>
Represents a trigger that can listen to an element other than its AssociatedObject.
public abstract class EventTriggerBase<T> : EventTriggerBase, IAnimatable, IAttachedObject where T : class
Type Parameters
T
The type that this trigger can be associated with.
- Inheritance
-
EventTriggerBase<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
EventTriggerBase extends TriggerBase to add knowledge of another object than the one it is attached to. This allows a user to attach a Trigger/Action pair to one element and invoke the Action in response to a change in another object somewhere else. Override OnSourceChanged to hook or unhook handlers on the source element, and OnAttached/OnDetaching for the associated element. The type of the Source element can be constrained by the generic type parameter. If you need control over the type of the AssociatedObject, set a TypeConstraintAttribute on your derived type.
Constructors
EventTriggerBase()
Initializes a new instance of the EventTriggerBase<T> class.
protected EventTriggerBase()
Properties
Source
Gets the resolved source. If is not set or cannot be resolved, defaults to AssociatedObject.
public T Source { get; }
Property Value
- T
The resolved source object.
Remarks
In general, this property should be used in place of AssociatedObject in derived classes.
Methods
OnSourceChanged(T, T)
Called when the source property changes.
protected virtual void OnSourceChanged(T oldSource, T newSource)
Parameters
oldSource
TThe old source.
newSource
TThe new source.
Remarks
Override this to hook functionality to and unhook functionality from the specified source, rather than the AssociatedObject.