using Avalonia;
using Avalonia.Controls;
using System;
namespace SukiUI.Extensions
{
public static class ResourceNodeExtensions
{
///
/// Finds the specified resource by searching up the logical tree and then global styles.
///
/// The control.
/// The resource key.
/// The resource, or if not found.
public static object FindRequiredResource(this IResourceHost? control, object key)
{
control = control ?? throw new ArgumentNullException(nameof(control));
return control.FindResource(key) ?? throw new ArgumentNullException("Could not find required resource with the specified key");
}
}
}