using Avalonia.Controls; using System; namespace SukiUI.Extensions { /// /// Adds common functionality to . /// public static class ControlExtensions { /// /// Finds the named control in the scope of the specified control. /// /// The type of the control to find. /// The control to look in. /// The name of the control to find. /// The control or throws if not found. /// public static T FindRequiredControl(this Control? control, string name) where T : Control { control = control ?? throw new ArgumentNullException(nameof(control)); return control.FindControl(name) ?? throw new ArgumentNullException("Could not find required control with the specified name"); } } }