Class TriggerAction
Represents an attachable object that encapsulates a unit of functionality.
[DefaultTrigger(typeof(UIElement), typeof(EventTrigger), "MouseLeftButtonDown")]
[DefaultTrigger(typeof(ButtonBase), typeof(EventTrigger), "Click")]
public abstract class TriggerAction : Animatable, IAnimatable, IAttachedObject
- Inheritance
-
TriggerAction
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
This is an infrastructure class. Action authors should derive from TriggerAction<T> instead of this class.
Fields
IsEnabledProperty
public static readonly DependencyProperty IsEnabledProperty
Field Value
Properties
AssociatedObject
Gets the object to which this action is attached.
protected DependencyObject AssociatedObject { get; }
Property Value
- DependencyObject
The associated object.
AssociatedObjectTypeConstraint
Gets the associated object type constraint.
protected virtual Type AssociatedObjectTypeConstraint { get; }
Property Value
- Type
The associated object type constraint.
IsEnabled
Gets or sets a value indicating whether this action will run when invoked. This is a dependency property.
public bool IsEnabled { get; set; }
Property Value
- bool
True
if this action will be run when invoked; otherwise,False
.
Methods
Attach(DependencyObject)
Attaches to the specified object.
public void Attach(DependencyObject dependencyObject)
Parameters
dependencyObject
DependencyObjectThe object to attach to.
Exceptions
- InvalidOperationException
Cannot host the same TriggerAction on more than one object at a time.
- InvalidOperationException
dependencyObject does not satisfy the TriggerAction type constraint.
CreateInstanceCore()
When implemented in a derived class, creates a new instance of the Freezable derived class.
protected override Freezable CreateInstanceCore()
Returns
- Freezable
The new instance.
Detach()
Detaches this instance from its associated object.
public void Detach()
Invoke(object)
Invokes the action.
protected abstract void Invoke(object parameter)
Parameters
parameter
objectThe parameter to the action. If the action does not require a parameter, the parameter may be set to a null reference.
OnAttached()
Called after the action is attached to an AssociatedObject.
protected virtual void OnAttached()
OnDetaching()
Called when the action is being detached from its AssociatedObject, but before it has actually occurred.
protected virtual void OnDetaching()