Class TargetedTriggerAction<T>
Represents an action that can be targeted to affect an object other than its AssociatedObject.
public abstract class TargetedTriggerAction<T> : TargetedTriggerAction, IAnimatable, IAttachedObject where T : class
Type Parameters
T
The type constraint on the target.
- Inheritance
-
TargetedTriggerAction<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
TargetedTriggerAction extends TriggerAction to add knowledge of another element than the one it is attached to. This allows a user to invoke the action on an element other than the one it is attached to in response to a trigger firing. Override OnTargetChanged to hook or unhook handlers on the target element, and OnAttached/OnDetaching for the associated element. The type of the Target 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
TargetedTriggerAction()
Initializes a new instance of the TargetedTriggerAction<T> class.
protected TargetedTriggerAction()
Properties
Target
Gets the target object. If TargetName is not set or cannot be resolved, defaults to the AssociatedObject.
protected T Target { get; }
Property Value
- T
The target.
Remarks
In general, this property should be used in place of AssociatedObject in derived classes.
Methods
OnTargetChanged(T, T)
Called when the target property changes.
protected virtual void OnTargetChanged(T oldTarget, T newTarget)
Parameters
oldTarget
TThe old target.
newTarget
TThe new target.
Remarks
Override this to hook and unhook functionality on the specified Target, rather than the AssociatedObject.