Skip to main content

AddClassHandler<TTarget, TValue>(IObservable<AvaloniaPropertyChangedEventArgs<TValue>>, Action<TTarget, AvaloniaPropertyChangedEventArgs<TValue>>) 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, TValue>(
this IObservable<AvaloniaPropertyChangedEventArgs<TValue>> observable,
Action<TTarget, AvaloniaPropertyChangedEventArgs<TValue>> action
)
where TTarget : AvaloniaObject

Parameters​

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

Type Parameters​

The type of the property change sender.
The type of the property.

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(TValue)). 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