Skip to content

Commit 2007272

Browse files
committed
标题栏按钮主题适配
1 parent 918a7b9 commit 2007272

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Utilities.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.UI;
22
using Microsoft.UI.Composition.SystemBackdrops;
3+
using Microsoft.UI.Windowing;
34
using Microsoft.UI.Xaml;
45
using Microsoft.UI.Xaml.Media;
56
using System;
@@ -52,6 +53,8 @@ public static void SetThemeColor(this Window window)
5253
if (window.Content is FrameworkElement rootElement)
5354
{
5455
rootElement.RequestedTheme = Enum.Parse<ElementTheme>(appearance);
56+
appearance = appearance == "Default" ? "UseDefaultAppMode" : appearance;
57+
window.AppWindow.TitleBar.PreferredTheme = Enum.Parse<TitleBarTheme>(appearance);
5558
}
5659
}
5760

0 commit comments

Comments
 (0)