Open ghost1372 opened 2 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
@ranjeshj we can fix issue with this:
private void AppTitleBar_Loaded(object sender, RoutedEventArgs e)
{
ApplySystemThemeToCaptionButtons(this);
}
private void AppTitleBar_ActualThemeChanged(FrameworkElement sender, object args)
{
ApplySystemThemeToCaptionButtons(this);
}
public static void ApplySystemThemeToCaptionButtons(Window window)
{
var res = Application.Current.Resources;
Windows.UI.Color buttonForegroundColor;
Windows.UI.Color buttonHoverForegroundColor;
Windows.UI.Color buttonHoverBackgroundColor;
if (App.themeService?.ActualTheme == ElementTheme.Dark)
{
buttonForegroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#FFFFFF");
buttonHoverForegroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#FFFFFF");
buttonHoverBackgroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#0FFFFFFF");
}
else
{
buttonForegroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#191919");
buttonHoverForegroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#191919");
buttonHoverBackgroundColor = WinUICommunity.ColorHelper.GetColorFromHex("#09000000");
}
res["WindowCaptionForeground"] = buttonForegroundColor;
window.AppWindow.TitleBar.ButtonForegroundColor = buttonForegroundColor;
window.AppWindow.TitleBar.ButtonHoverForegroundColor = buttonHoverForegroundColor;
window.AppWindow.TitleBar.ButtonHoverBackgroundColor = buttonHoverBackgroundColor;
}
Describe the bug
New TitleBar Caption Button Colors only works when Windows Theme and App Theme is Same! for example: Windows Theme: Dark App Theme: Dark Caption Button Colors is Correct.
Windows Theme: Dark App Theme: Light Caption Button Colors is Wrong.
and vice verca:
Windows Theme: Light App Theme: Light Caption Button Colors is Correct
Windows Theme: Light App Theme: Dark Caption Button Colors is Wrong
Steps to reproduce the bug
1.Create new titlebar app 2.Set Windows Theme to Dark 3.Set App Theme to Light
or
Set Windows Theme to Light Set App Theme to Dark See Wrong Colors
Expected behavior
No response
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.6 Experimental 2: 1.6.240701003-experimental2
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response