Table of Contents

Class AvaloniaObjectExtensions

Namespace
CarinaStudio
Assembly
CarinaStudio.AppBase.Avalonia.dll

Extensions for Avalonia.AvaloniaObject.

public static class AvaloniaObjectExtensions
Inheritance
AvaloniaObjectExtensions
Inherited Members

Methods

BindToResource(AvaloniaObject, AvaloniaProperty, IResourceHost, object)

Bind property to given resource.

public static IDisposable BindToResource(this AvaloniaObject obj, AvaloniaProperty property, IResourceHost resourceHost, object resourceKey)

Parameters

obj AvaloniaObject

Target object.

property AvaloniaProperty

Property to bind.

resourceHost IResourceHost

Avalonia.Controls.IResourceHost to find resource.

resourceKey object

Resource key.

Returns

IDisposable

Token of binding.

WaitForPropertyChangeAsync<TObj>(TObj, AvaloniaProperty, object?, CancellationToken)

Wait for property changing to desired value asynchronously.

public static Task WaitForPropertyChangeAsync<TObj>(this TObj obj, AvaloniaProperty property, object? value, CancellationToken cancellationToken = default) where TObj : AvaloniaObject

Parameters

obj TObj

Object owns the property.

property AvaloniaProperty

The property.

value object

Desired value.

cancellationToken CancellationToken

CancellationToken to cancel waiting.

Returns

Task

Task of waiting for property value.

Type Parameters

TObj

Type of object.

WaitForPropertyChangeAsync<TObj, TValue>(TObj, AvaloniaProperty<TValue>, TValue?, CancellationToken)

Wait for property changing to desired value asynchronously.

public static Task WaitForPropertyChangeAsync<TObj, TValue>(this TObj obj, AvaloniaProperty<TValue> property, TValue? value, CancellationToken cancellationToken = default) where TObj : AvaloniaObject

Parameters

obj TObj

Object owns the property.

property AvaloniaProperty<TValue>

The property.

value TValue

Desired value.

cancellationToken CancellationToken

CancellationToken to cancel waiting.

Returns

Task

Task of waiting for property value.

Type Parameters

TObj

Type of object.

TValue

Type of property value.