using System; using Avalonia.Controls; using Avalonia.Media; namespace Avalonia; public static partial class ControlExtensions { public static TElement Col(this TElement control, int value) where TElement : Control { Grid.SetColumn(control, value); return control; } public static TElement Row(this TElement control, int value) where TElement : Control { Grid.SetRow(control, value); return control; } public static TPanel Add(this TPanel container, params Control[] children) where TPanel : IPanel { foreach (var child in children) container.Children.Add(child); return container; } public static TPanel AddNew(this TPanel container, Action childInitializer) where TPanel : IPanel where TControl : Control, new() { var child = new TControl(); childInitializer.Invoke(child); container.Children.Add(child); return container; } public static TElement Apply(this TElement control, Action styleAction) { styleAction(control); return control; } }