diff --git a/components/TitleBar/src/TitleBar.WASDK.cs b/components/TitleBar/src/TitleBar.WASDK.cs index d2e7f68f..584bd5e5 100644 --- a/components/TitleBar/src/TitleBar.WASDK.cs +++ b/components/TitleBar/src/TitleBar.WASDK.cs @@ -44,8 +44,14 @@ private void SetWASDKTitleBar() this.Window.Activated -= Window_Activated; this.Window.Activated += Window_Activated; - Window.AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; - Window.AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + if (Window.Content is FrameworkElement rootElement) + { + UpdateCaptionButtons(rootElement); + rootElement.ActualThemeChanged += (s, e) => + { + UpdateCaptionButtons(rootElement); + }; + } // Set the width of padding columns in the UI. PART_ButtonsHolderColumn = GetTemplateChild(nameof(PART_ButtonsHolderColumn)) as ColumnDefinition; @@ -80,6 +86,22 @@ private void SetWASDKTitleBar() } } + private void UpdateCaptionButtons(FrameworkElement rootElement) + { + Window.AppWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; + Window.AppWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; + if (rootElement.ActualTheme == ElementTheme.Dark) + { + Window.AppWindow.TitleBar.ButtonForegroundColor = Colors.White; + Window.AppWindow.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray; + } + else + { + Window.AppWindow.TitleBar.ButtonForegroundColor = Colors.Black; + Window.AppWindow.TitleBar.ButtonInactiveForegroundColor = Colors.DarkGray; + } + } + private void ResetWASDKTitleBar() { if (this.Window == null)