Open
Description
Describe the bug
The TitleBar has always the Standard Height and doesn't respect the AppWindow.TitleBar.PreferredHeightOption setting
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 sealed partial class MainWindow : Window
{
public string[] TitleBarHeights = ["Standard", "Tall", "Collapsed"];
public MainWindow()
{
this.InitializeComponent();
ExtendsContentIntoTitleBar = true;
}
private void TitleBarHeight_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is RadioButtons radioButtons)
{
AppWindow.TitleBar.PreferredHeightOption = radioButtons.SelectedIndex switch
{
1 => TitleBarHeightOption.Tall,
2 => TitleBarHeightOption.Collapsed,
_ => TitleBarHeightOption.Standard
};
}
}
}
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">
<RadioButtons ItemsSource="{x:Bind TitleBarHeights}" HorizontalAlignment="Center" VerticalAlignment="Center"
SelectedIndex="0" SelectionChanged="TitleBarHeight_SelectionChanged" />
</Grid>
</Grid>
Run the project. If you change the radio button, the bar stays the same, but the title bar height changes (you can check by trying the buttons and the in-app-toolbar in the app). For the Collapsed settings, the buttons disappear, and you can't move the window anymore
This project has a sample of the bug: https://github.com/brunosonnino/TitleBarBugs/tree/main/2%20-%20TitleBarHeight
Expected behavior
The TitleBar should respect the 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