修复了系统标题栏的问题。
This commit is contained in:
lincube
2026-03-23 12:34:04 +08:00
parent 8ded721f46
commit ac7e8db516
2 changed files with 16 additions and 3 deletions

View File

@@ -36,7 +36,8 @@
</Style> </Style>
</Window.Styles> </Window.Styles>
<Grid Classes="settings-scope" <Grid x:Name="RootGrid"
Classes="settings-scope"
Background="{DynamicResource AdaptiveSettingsWindowBackgroundBrush}" Background="{DynamicResource AdaptiveSettingsWindowBackgroundBrush}"
RowDefinitions="Auto,*"> RowDefinitions="Auto,*">
<Border x:Name="WindowTitleBarHost" <Border x:Name="WindowTitleBarHost"

View File

@@ -32,7 +32,7 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
private readonly IHostApplicationLifecycle _hostApplicationLifecycle; private readonly IHostApplicationLifecycle _hostApplicationLifecycle;
private readonly IAppLogoService _appLogoService = HostAppLogoProvider.GetOrCreate(); private readonly IAppLogoService _appLogoService = HostAppLogoProvider.GetOrCreate();
private readonly Dictionary<string, Control> _cachedPages = new(StringComparer.OrdinalIgnoreCase); private readonly Dictionary<string, Control> _cachedPages = new(StringComparer.OrdinalIgnoreCase);
private readonly bool _useSystemChrome; private bool _useSystemChrome;
private bool _isResponsiveRefreshPending; private bool _isResponsiveRefreshPending;
private bool _isRestartPromptVisible; private bool _isRestartPromptVisible;
@@ -152,12 +152,19 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
public void ApplyChromeMode(bool useSystemChrome) public void ApplyChromeMode(bool useSystemChrome)
{ {
if (useSystemChrome || OperatingSystem.IsMacOS()) _useSystemChrome = useSystemChrome || OperatingSystem.IsMacOS();
if (_useSystemChrome)
{ {
ExtendClientAreaToDecorationsHint = true; ExtendClientAreaToDecorationsHint = true;
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.PreferSystemChrome; ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.PreferSystemChrome;
ExtendClientAreaTitleBarHeightHint = -1; ExtendClientAreaTitleBarHeightHint = -1;
SystemDecorations = SystemDecorations.Full; SystemDecorations = SystemDecorations.Full;
if (WindowTitleBarHost is { })
{
WindowTitleBarHost.IsVisible = false;
}
return; return;
} }
@@ -165,6 +172,11 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
ExtendClientAreaToDecorationsHint = true; ExtendClientAreaToDecorationsHint = true;
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome; ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
ExtendClientAreaTitleBarHeightHint = 48; ExtendClientAreaTitleBarHeightHint = 48;
if (WindowTitleBarHost is { })
{
WindowTitleBarHost.IsVisible = true;
}
} }
public void RefreshShellText() public void RefreshShellText()