diff --git a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml index c3973aeb4..77f4a4c96 100644 --- a/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml +++ b/src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml @@ -18,6 +18,8 @@ + + @@ -81,6 +83,7 @@ + diff --git a/src/UniGetUI.Avalonia/Infrastructure/MicaWindowHelper.cs b/src/UniGetUI.Avalonia/Infrastructure/MicaWindowHelper.cs index 7987e2a69..beab6ec6f 100644 --- a/src/UniGetUI.Avalonia/Infrastructure/MicaWindowHelper.cs +++ b/src/UniGetUI.Avalonia/Infrastructure/MicaWindowHelper.cs @@ -10,19 +10,18 @@ namespace UniGetUI.Avalonia.Infrastructure; /// /// Gives a standard Avalonia the native Windows 11 look: -/// the Mica backdrop (whole-window), rounded corners, and an accent-colored border -/// that follows focus. Windows-only and gated on Windows 11; a no-op elsewhere, so +/// the Mica backdrop (whole-window) and rounded corners. The window border is left +/// at the OS default, so it only shows an accent color if the user enabled that in +/// Personalization. Windows-only and gated on Windows 11; a no-op elsewhere, so /// the window keeps its opaque look when Mica isn't available. /// Used by the secondary windows/dialogs; MainWindow has its own (custom-frame) variant. /// internal static class MicaWindowHelper { private const int DWMWA_WINDOW_CORNER_PREFERENCE = 33; - private const int DWMWA_BORDER_COLOR = 34; private const int DWMWA_SYSTEMBACKDROP_TYPE = 38; private const int DWMWCP_ROUND = 2; private const int DWMSBT_TRANSIENTWINDOW = 3; // Acrylic — for transient surfaces (menus/flyouts); Mica won't paint on these - private const int DWMWA_COLOR_DEFAULT = unchecked((int)0xFFFFFFFF); private static bool _acrylicPopupsHooked; @@ -44,20 +43,7 @@ public static void Apply(Window window) NativeMethods.DwmSetWindowAttribute(handle, DWMWA_WINDOW_CORNER_PREFERENCE, ref corner, sizeof(int)); } window.Background = Brushes.Transparent; - ApplyBorderAccent(window, window.IsActive); }; - - window.GetObservable(WindowBase.IsActiveProperty).Subscribe(active => ApplyBorderAccent(window, active)); - - if (Application.Current?.PlatformSettings is { } settings) - { - void Handler(object? s, PlatformColorValues e) - { - if (window.IsActive) ApplyBorderAccent(window, true); - } - settings.ColorValuesChanged += Handler; - window.Closed += (_, _) => settings.ColorValuesChanged -= Handler; - } } // Gives flyouts / menus / combo dropdowns / tooltips a native Win11 acrylic backdrop: @@ -102,22 +88,6 @@ private static void ApplyAcrylicToPopup(TopLevel root) NativeMethods.DwmSetWindowAttribute(handle, DWMWA_SYSTEMBACKDROP_TYPE, ref backdrop, sizeof(int)); } - // Accent-coloured window border that follows focus (kept on the dialogs). - private static void ApplyBorderAccent(Window window, bool active) - { - if (window.TryGetPlatformHandle()?.Handle is not { } handle || handle == 0) - return; - - int colorRef = DWMWA_COLOR_DEFAULT; - if (active) - { - Color accent = Application.Current?.PlatformSettings?.GetColorValues().AccentColor1 - ?? Colors.Transparent; - colorRef = accent.R | (accent.G << 8) | (accent.B << 16); // Color -> COLORREF (0x00BBGGRR) - } - NativeMethods.DwmSetWindowAttribute(handle, DWMWA_BORDER_COLOR, ref colorRef, sizeof(int)); - } - /// /// True when the native Mica look should be used: Windows 11+ AND the user has /// "Transparency effects" enabled. When transparency is off we keep the solid look, diff --git a/src/UniGetUI.Avalonia/Views/DialogPages/PackageDetailsWindow.axaml.cs b/src/UniGetUI.Avalonia/Views/DialogPages/PackageDetailsWindow.axaml.cs index 3c991cabb..9fe331047 100644 --- a/src/UniGetUI.Avalonia/Views/DialogPages/PackageDetailsWindow.axaml.cs +++ b/src/UniGetUI.Avalonia/Views/DialogPages/PackageDetailsWindow.axaml.cs @@ -399,9 +399,10 @@ private void AddDownloadRow(StackPanel host) host.Children.Add(tb); } - private static IBrush LinkBrush => - Application.Current?.Resources["AccentTextFillColorPrimaryBrush"] as IBrush - ?? new SolidColorBrush(Color.FromArgb(255, 0, 120, 212)); + private IBrush LinkBrush => + this.TryFindResource("HyperlinkForeground", ActualThemeVariant, out var res) && res is IBrush b + ? b + : new SolidColorBrush(Color.FromArgb(255, 0, 120, 212)); private static void OpenUrl(string url) { diff --git a/src/UniGetUI.Avalonia/Views/SoftwarePages/AbstractPackagesPage.axaml.cs b/src/UniGetUI.Avalonia/Views/SoftwarePages/AbstractPackagesPage.axaml.cs index 160250e65..d8fc511b5 100644 --- a/src/UniGetUI.Avalonia/Views/SoftwarePages/AbstractPackagesPage.axaml.cs +++ b/src/UniGetUI.Avalonia/Views/SoftwarePages/AbstractPackagesPage.axaml.cs @@ -24,6 +24,7 @@ public abstract partial class AbstractPackagesPage : UserControl, private readonly ContextMenu? _contextMenu; private double _savedFilterPaneWidth = 220; private bool _isOverlayMode; + private IDisposable? _sidePanelBgBinding; protected AbstractPackagesPage(PackagesPageData data) { @@ -349,16 +350,22 @@ private void UpdateFilterPaneColumn(bool open) SidePanel.Width = _savedFilterPaneWidth; SidePanel.HorizontalAlignment = HorizontalAlignment.Left; + // Floating over content needs an opaque surface (the page surface is transparent under Mica). + _sidePanelBgBinding ??= SidePanel.Bind(Border.BackgroundProperty, this.GetResourceObservable("AppWindowBackground")); + // Semi-transparent backdrop covers the package list behind the pane. FilterOverlayBackdrop.IsVisible = open; } else { - // Inline mode: pane sits beside the package list. + // Inline mode: pane sits beside the package list and blends with the Mica page surface. Grid.SetColumnSpan(SidePanel, 1); SidePanel.ZIndex = 0; SidePanel.Width = double.NaN; SidePanel.HorizontalAlignment = HorizontalAlignment.Stretch; + _sidePanelBgBinding?.Dispose(); + _sidePanelBgBinding = null; + SidePanel.Background = null; FilterOverlayBackdrop.IsVisible = false; FilteringPanel.ColumnDefinitions[0].Width = open