microsoft / microsoft/microsoft-ui-xaml

TitleBar title doesn't propagate to window

Open
#10,557 26 comments 1 reaction 0 assignees View on GitHub
area-TitleBar area-Windowing feature proposal spec issue team-Core
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

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

1. Create a window with the new TitleBar
2. Set the Title and subtitle of the TitleBar
3. Run the app and hover on the task bar. Notice the window title:
![Image](https://github.com/user-attachments/assets/6bbe5b02-f377-484a-a3a6-9999e8f20281)
4. 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:
```cs
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;
}
```

-- Maintainer Edit below --
# Poll on expected behavior here: https://github.com/microsoft/microsoft-ui-xaml/discussions/11083

Contributor guide

Open the contributing guide

Research direction

Start with the TitleBar TitleProperty and SubtitleProperty behavior and the window Title update shown in the workaround. Review discussion 11083 and its poll before deciding the expected title composition. Done means the taskbar and Narrator use the TitleBar's intended title without requiring application-side property callbacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
accessibility, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.