Skip to main content

TryGetResource Method

Tries to find a resource within the object.

Definition​

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

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

Parameters​

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

Return Value​

Boolean
True if the resource if found, otherwise false.

Usage Note​

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

ResourceNodeExtensions Class
Avalonia.Controls Namespace