Skip to main content

AddClassHandler<TTarget>(IObservable<AvaloniaPropertyChangedEventArgs>, Action<TTarget, AvaloniaPropertyChangedEventArgs>) Method

Subscribes to a property changed notifications for changes that originate from a TTarget.

Definition​

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static IDisposable AddClassHandler<TTarget>(
this IObservable<AvaloniaPropertyChangedEventArgs> observable,
Action<TTarget, AvaloniaPropertyChangedEventArgs> action
)
where TTarget : AvaloniaObject

Parameters​

  IObservable(AvaloniaPropertyChangedEventArgs)
The property changed observable.
  Action(TTarget, AvaloniaPropertyChangedEventArgs)
The method to call. The parameters are the sender and the event args.

Type Parameters​

The type of the property change sender.

Return Value​

IDisposable
A disposable that can be used to terminate the subscription.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type IObservable(AvaloniaPropertyChangedEventArgs). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also​

Reference​

AvaloniaObjectExtensions Class
AddClassHandler Overload
Avalonia Namespace