Skip to content

Commit

Permalink
Merge pull request #461 from ghost1372/TitleBar-CaptionButtons
Browse files Browse the repository at this point in the history
UpdateCaptionButtons
  • Loading branch information
niels9001 authored Jul 7, 2023
2 parents 8094a33 + 2015162 commit 3e63cd7
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions components/TitleBar/src/TitleBar.WASDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3e63cd7

Please sign in to comment.