Table of Contents

Class ResourceNodeExtensions

Namespace
Avalonia.Controls
Assembly
Avalonia.Base.dll
public static class ResourceNodeExtensions
Inheritance
ResourceNodeExtensions
Inherited Members

Methods

FindResource(IResourceHost, ThemeVariant?, object)

Finds the specified resource by searching up the logical tree and then global styles.

public static object? FindResource(this IResourceHost control, ThemeVariant? theme, object key)

Parameters

control IResourceHost

The control.

theme ThemeVariant

Theme used to select theme dictionary.

key object

The resource key.

Returns

object

The resource, or UnsetValue if not found.

FindResource(IResourceHost, object)

Finds the specified resource by searching up the logical tree and then global styles.

public static object? FindResource(this IResourceHost control, object key)

Parameters

control IResourceHost

The control.

key object

The resource key.

Returns

object

The resource, or UnsetValue if not found.

GetResourceObservable(IResourceHost, object, Func<object?, object?>?)

public static IObservable<object?> GetResourceObservable(this IResourceHost control, object key, Func<object?, object?>? converter = null)

Parameters

control IResourceHost
key object
converter Func<object, object>

Returns

IObservable<object>

GetResourceObservable(IResourceProvider, object, ThemeVariant?, Func<object?, object?>?)

public static IObservable<object?> GetResourceObservable(this IResourceProvider resourceProvider, object key, ThemeVariant? defaultThemeVariant, Func<object?, object?>? converter = null)

Parameters

resourceProvider IResourceProvider
key object
defaultThemeVariant ThemeVariant
converter Func<object, object>

Returns

IObservable<object>

GetResourceObservable(IResourceProvider, object, Func<object?, object?>?)

public static IObservable<object?> GetResourceObservable(this IResourceProvider resourceProvider, object key, Func<object?, object?>? converter = null)

Parameters

resourceProvider IResourceProvider
key object
converter Func<object, object>

Returns

IObservable<object>

TryFindResource(IResourceHost, object, ThemeVariant?, out object?)

Tries to the specified resource by searching up the logical tree and then global styles.

public static bool TryFindResource(this IResourceHost control, object key, ThemeVariant? theme, out object? value)

Parameters

control IResourceHost

The control.

key object

The resource key.

theme ThemeVariant

Theme used to select theme dictionary.

value object

On return, contains the resource if found, otherwise null.

Returns

bool

True if the resource was found; otherwise false.

TryFindResource(IResourceHost, object, out object?)

Tries to the specified resource by searching up the logical tree and then global styles.

public static bool TryFindResource(this IResourceHost control, object key, out object? value)

Parameters

control IResourceHost

The control.

key object

The resource key.

value object

On return, contains the resource if found, otherwise null.

Returns

bool

True if the resource was found; otherwise false.

TryGetResource(IResourceHost, object, out object?)

Tries to find a resource within the object.

public static bool TryGetResource(this IResourceHost control, object key, out object? value)

Parameters

control IResourceHost
key object

The resource key.

value object

When this method returns, contains the value associated with the specified key, if the key is found; otherwise, null.

Returns

bool

True if the resource if found, otherwise false.