Show / Hide Table of Contents

Class Behavior

Encapsulates state information and zero or more ICommands into an attachable object.

Inheritance
System.Object
DependencyObject
Behavior
Behavior<T>
Implements
IAttachedObject
Inherited Members
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.INTERNAL_OnAttachedToVisualTree()
DependencyObject.INTERNAL_OnDetachedFromVisualTree()
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Interactivity
Assembly: OpenSilver.Interactivity.dll
Syntax
public abstract class Behavior : DependencyObject, IDependencyObject, IAttachedObject
Remarks

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

Properties

| Improve this Doc View Source

AssociatedObject

Gets the object to which this behavior is attached.

Declaration
protected DependencyObject AssociatedObject { get; }
Property Value
Type Description
DependencyObject
| Improve this Doc View Source

AssociatedType

The type to which this behavior can be attached.

Declaration
protected Type AssociatedType { get; }
Property Value
Type Description
System.Type

Methods

| Improve this Doc View Source

Attach(DependencyObject)

Attaches to the specified object.

Declaration
public void Attach(DependencyObject dependencyObject)
Parameters
Type Name Description
DependencyObject dependencyObject

The object to attach to.

Exceptions
Type Condition
System.InvalidOperationException

The Behavior is already hosted on a different element.

System.InvalidOperationException

dependencyObject does not satisfy the Behavior type constraint.

| Improve this Doc View Source

Detach()

Detaches this instance from its associated object.

Declaration
public void Detach()
| Improve this Doc View Source

OnAttached()

Called after the behavior is attached to an AssociatedObject.

Declaration
protected virtual void OnAttached()
Remarks

Override this to hook up functionality to the AssociatedObject.

| Improve this Doc View Source

OnDetaching()

Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.

Declaration
protected virtual void OnDetaching()
Remarks

Override this to unhook functionality from the AssociatedObject.

Explicit Interface Implementations

| Improve this Doc View Source

IAttachedObject.AssociatedObject

Gets the associated object.

Declaration
DependencyObject IAttachedObject.AssociatedObject { get; }
Returns
Type Description
DependencyObject

The associated object.

Implements

IAttachedObject

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
  • Improve this Doc
  • View Source