From ebb7a7eba2551adfeb9cababf8123245f6187269 Mon Sep 17 00:00:00 2001 From: GabrielDuf Date: Tue, 23 Jun 2026 09:05:39 -0400 Subject: [PATCH 1/3] Fix Avalonia banner, settings card, and search underline visuals --- .../Views/Controls/InfoBar.axaml | 5 ++- .../Views/Controls/Settings/SettingsCard.cs | 36 +++++++++++++++++-- src/UniGetUI.Avalonia/Views/MainWindow.axaml | 2 +- .../SoftwarePages/AbstractPackagesPage.axaml | 2 +- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml b/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml index a4f33a00a7..e068b83284 100644 --- a/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml +++ b/src/UniGetUI.Avalonia/Views/Controls/InfoBar.axaml @@ -27,7 +27,10 @@ _border.CornerRadius = value; } + // Base (unfocused) thickness as assigned by the consumer. Grouped cards use a + // partial thickness like "1,0,1,1" to share a divider with the card above; we + // must remember it so we can restore it when focus leaves. + private Thickness _baseBorderThickness = new(1); + public new Thickness BorderThickness { get => _border.BorderThickness; - set => _border.BorderThickness = value; + set + { + _baseBorderThickness = value; + // While focused the border is forced complete (see GotFocus); don't clobber it. + if (!_border.Classes.Contains("settings-card-focused")) + _border.BorderThickness = value; + } + } + + // A focused card needs a border on all four sides, even when its base thickness omits + // the top (grouped cards). The accent focus style can't supply this: BorderThickness is + // a local value on _border, which wins over the style setter — so we set it here instead. + private static Thickness FocusedBorderThickness(Thickness baseThickness) + { + double t = Math.Max(Math.Max(baseThickness.Left, baseThickness.Right), + Math.Max(baseThickness.Top, baseThickness.Bottom)); + return new Thickness(Math.Max(t, 1)); } // ── Constructor ──────────────────────────────────────────────────────── @@ -216,8 +237,17 @@ public SettingsCard() PointerPressed += OnPointerPressed; KeyDown += OnKeyDown; - GotFocus += (_, _) => { if (_isClickEnabled) _border.Classes.Add("settings-card-focused"); }; - LostFocus += (_, _) => _border.Classes.Remove("settings-card-focused"); + GotFocus += (_, _) => + { + if (!_isClickEnabled) return; + _border.Classes.Add("settings-card-focused"); + _border.BorderThickness = FocusedBorderThickness(_baseBorderThickness); + }; + LostFocus += (_, _) => + { + _border.Classes.Remove("settings-card-focused"); + _border.BorderThickness = _baseBorderThickness; + }; SyncAutomationProperties(); } diff --git a/src/UniGetUI.Avalonia/Views/MainWindow.axaml b/src/UniGetUI.Avalonia/Views/MainWindow.axaml index acdd530a82..e3c97175c9 100644 --- a/src/UniGetUI.Avalonia/Views/MainWindow.axaml +++ b/src/UniGetUI.Avalonia/Views/MainWindow.axaml @@ -22,7 +22,7 @@ via styles (opacity) so the .focus-within setter wins over the base. -->