@@ -39,50 +39,35 @@ public static void UpdateTitleBar(ElementTheme theme)
3939 theme = Application . Current . RequestedTheme == ApplicationTheme . Light ? ElementTheme . Light : ElementTheme . Dark ;
4040 }
4141
42- Application . Current . Resources [ "WindowCaptionForeground" ] = theme switch
42+ App . MainWindow . AppWindow . TitleBar . ButtonForegroundColor = theme switch
4343 {
44- ElementTheme . Dark => new SolidColorBrush ( Colors . White ) ,
45- ElementTheme . Light => new SolidColorBrush ( Colors . Black ) ,
46- _ => new SolidColorBrush ( Colors . Transparent )
44+ ElementTheme . Dark => Colors . White ,
45+ ElementTheme . Light => Colors . Black ,
46+ _ => Colors . Transparent
4747 } ;
4848
49- Application . Current . Resources [ "WindowCaptionForegroundDisabled" ] = theme switch
49+ App . MainWindow . AppWindow . TitleBar . ButtonHoverForegroundColor = theme switch
5050 {
51- ElementTheme . Dark => new SolidColorBrush ( Color . FromArgb ( 0x66 , 0xFF , 0xFF , 0xFF ) ) ,
52- ElementTheme . Light => new SolidColorBrush ( Color . FromArgb ( 0x66 , 0x00 , 0x00 , 0x00 ) ) ,
53- _ => new SolidColorBrush ( Colors . Transparent )
51+ ElementTheme . Dark => Colors . White ,
52+ ElementTheme . Light => Colors . Black ,
53+ _ => Colors . Transparent
5454 } ;
5555
56- Application . Current . Resources [ "WindowCaptionButtonBackgroundPointerOver" ] = theme switch
56+ App . MainWindow . AppWindow . TitleBar . ButtonHoverBackgroundColor = theme switch
5757 {
58- ElementTheme . Dark => new SolidColorBrush ( Color . FromArgb ( 0x33 , 0xFF , 0xFF , 0xFF ) ) ,
59- ElementTheme . Light => new SolidColorBrush ( Color . FromArgb ( 0x33 , 0x00 , 0x00 , 0x00 ) ) ,
60- _ => new SolidColorBrush ( Colors . Transparent )
58+ ElementTheme . Dark => Color . FromArgb ( 0x33 , 0xFF , 0xFF , 0xFF ) ,
59+ ElementTheme . Light => Color . FromArgb ( 0x33 , 0x00 , 0x00 , 0x00 ) ,
60+ _ => Colors . Transparent
6161 } ;
6262
63- Application . Current . Resources [ "WindowCaptionButtonBackgroundPressed" ] = theme switch
63+ App . MainWindow . AppWindow . TitleBar . ButtonPressedBackgroundColor = theme switch
6464 {
65- ElementTheme . Dark => new SolidColorBrush ( Color . FromArgb ( 0x66 , 0xFF , 0xFF , 0xFF ) ) ,
66- ElementTheme . Light => new SolidColorBrush ( Color . FromArgb ( 0x66 , 0x00 , 0x00 , 0x00 ) ) ,
67- _ => new SolidColorBrush ( Colors . Transparent )
65+ ElementTheme . Dark => Color . FromArgb ( 0x66 , 0xFF , 0xFF , 0xFF ) ,
66+ ElementTheme . Light => Color . FromArgb ( 0x66 , 0x00 , 0x00 , 0x00 ) ,
67+ _ => Colors . Transparent
6868 } ;
6969
70- Application . Current . Resources [ "WindowCaptionButtonStrokePointerOver" ] = theme switch
71- {
72- ElementTheme . Dark => new SolidColorBrush ( Colors . White ) ,
73- ElementTheme . Light => new SolidColorBrush ( Colors . Black ) ,
74- _ => new SolidColorBrush ( Colors . Transparent )
75- } ;
76-
77- Application . Current . Resources [ "WindowCaptionButtonStrokePressed" ] = theme switch
78- {
79- ElementTheme . Dark => new SolidColorBrush ( Colors . White ) ,
80- ElementTheme . Light => new SolidColorBrush ( Colors . Black ) ,
81- _ => new SolidColorBrush ( Colors . Transparent )
82- } ;
83-
84- Application . Current . Resources [ "WindowCaptionBackground" ] = new SolidColorBrush ( Colors . Transparent ) ;
85- Application . Current . Resources [ "WindowCaptionBackgroundDisabled" ] = new SolidColorBrush ( Colors . Transparent ) ;
70+ App . MainWindow . AppWindow . TitleBar . BackgroundColor = Colors . Transparent ;
8671
8772 var hwnd = WinRT . Interop . WindowNative . GetWindowHandle ( App . MainWindow ) ;
8873 if ( hwnd == GetActiveWindow ( ) )
@@ -100,19 +85,9 @@ public static void UpdateTitleBar(ElementTheme theme)
10085
10186 public static void ApplySystemThemeToCaptionButtons ( )
10287 {
103- var res = Application . Current . Resources ;
10488 var frame = App . AppTitlebar as FrameworkElement ;
10589 if ( frame != null )
10690 {
107- if ( frame . ActualTheme == ElementTheme . Dark )
108- {
109- res [ "WindowCaptionForeground" ] = Colors . White ;
110- }
111- else
112- {
113- res [ "WindowCaptionForeground" ] = Colors . Black ;
114- }
115-
11691 UpdateTitleBar ( frame . ActualTheme ) ;
11792 }
11893 }
0 commit comments