Skip to main content

GetObservable<T>(AvaloniaObject, AvaloniaProperty<T>) Method

Gets an observable for an AvaloniaProperty.

Definition​

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

public static IObservable<T> GetObservable<T>(
this AvaloniaObject o,
AvaloniaProperty<T> property
)

Parameters​

  AvaloniaObject
The object.
  AvaloniaProperty(T)
The property.

Type Parameters​

The property type.

Return Value​

IObservable(T)
An observable which fires immediately with the current value of the property on the object and subsequently each time the property value changes.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type AvaloniaObject. 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).

Remarks​

The subscription to o is created using a weak reference.

See Also​

Reference​

AvaloniaObjectExtensions Class
GetObservable Overload
Avalonia Namespace