Open
Description
Describe the bug
You cannot set the colors of the title and subtitle of a titlebar using AppWindow.TitleBar.ForegroundColor
Steps to reproduce the bug
- Create a Blank WinUI3 app
- Upgrade the WindowsAppSdk Nuget package to 1.6 experimental 2
- Change the project file to add
<WindowsSdkPackageVersion>10.0.19041.35-preview</WindowsSdkPackageVersion>
Add this code in MainWindow.xaml.cs
public MainWindow()
{
this.InitializeComponent();
ExtendsContentIntoTitleBar = true;
AppWindow.TitleBar.ForegroundColor = Colors.Yellow;
}
Add this code to MainWindow.xaml:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TitleBar Title="Title" Subtitle="SubTitle" IsBackButtonVisible="True"
IsPaneToggleButtonVisible="True" >
<TitleBar.IconSource>
<FontIconSource Glyph="" />
</TitleBar.IconSource>
</TitleBar>
<Grid Grid.Row="1" Background="Aqua">
</Grid>
</Grid>
Run the project. Although the TitleBar foreground is set, the color remains the same.
The workaround for this is to set the ThemeResources associated with the Foreground in the xaml file:
<Grid.Resources>
<SolidColorBrush x:Key="TitleBarForegroundBrush" Color="Yellow" />
<SolidColorBrush x:Key="TitleBarSubtitleForegroundBrush" Color="Yellow" />
</Grid.Resources>
This project shows a sample of the bug: https://github.com/brunosonnino/TitleBarBugs/tree/main/3%20-%20TitleBarBackground
Expected behavior
The colors of the title and subtitle of the titlebar should honor the ForegroundColor setting
Screenshots
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