Class Behavior
Encapsulates state information and zero or more ICommands into an attachable object.
public abstract class Behavior : Animatable, IAnimatable, IAttachedObject
- Inheritance
-
Behavior
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
This is an infrastructure class. Behavior authors should derive from Behavior<T> instead of from this class.
Properties
AssociatedObject
Gets the object to which this behavior is attached.
protected DependencyObject AssociatedObject { get; }
Property Value
AssociatedType
The type to which this behavior can be attached.
protected Type AssociatedType { get; }
Property Value
Methods
Attach(DependencyObject)
Attaches to the specified object.
public void Attach(DependencyObject dependencyObject)
Parameters
dependencyObject
DependencyObjectThe object to attach to.
Exceptions
- InvalidOperationException
The Behavior is already hosted on a different element.
- InvalidOperationException
dependencyObject does not satisfy the Behavior 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()
OnAttached()
Called after the behavior is attached to an AssociatedObject.
protected virtual void OnAttached()
Remarks
Override this to hook up functionality to the AssociatedObject.
OnDetaching()
Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.
protected virtual void OnDetaching()
Remarks
Override this to unhook functionality from the AssociatedObject.