-
Notifications
You must be signed in to change notification settings - Fork 766
Open
Labels
area-TitleBarIssues related to custom window title bars.Issues related to custom window title bars.bugSomething isn't workingSomething isn't working
Description
Describe the bug
When setting the Title and subtitle on the titlebar control, the actual window's title stays "WinUI Desktop".
This means when you hover on the taskbar, it'll still show the default "WinUI Desktop", and if you enable narrator the wrong window title will be spoken when the window activates
Steps to reproduce the bug
- Create a window with the new TitleBar
- Set the Title and subtitle of the TitleBar
- Run the app and hover on the task bar. Notice the window title:
- Start Narrator and activate the window. Notice that the narrator will say "WinUI Desktop", and not the TitleBar's Title.
Expected behavior
The correct taskbar title should be set.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.7.1: 1.7.250401001
Windows version
Windows 11 (24H2): Build 26100
Additional context
As a workaround you can do something ugly like this, but this really shouldn't be necessary and the issue is easily overlooked and leads to accessibility issues if you forget to add something like this:
public MainWindow()
{
this.InitializeComponent();
#region Workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/10557
MainWindowTitleBar.RegisterPropertyChangedCallback(Microsoft.UI.Xaml.Controls.TitleBar.TitleProperty, (s, e) => UpdateWindowTitle() );
MainWindowTitleBar.RegisterPropertyChangedCallback(Microsoft.UI.Xaml.Controls.TitleBar.SubtitleProperty, (s, e) => UpdateWindowTitle());
UpdateWindowTitle();
#endregion
}
private void UpdateWindowTitle()
{
// This ensures the Title on the taskbar matches the window title, and narrator will read the correct title
this.Title = MainWindowTitleBar.Title + " - " + MainWindowTitleBar.Subtitle;
}
Metadata
Metadata
Assignees
Labels
area-TitleBarIssues related to custom window title bars.Issues related to custom window title bars.bugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog