microsoft / microsoft/microsoft-ui-xaml
Title bar is messed up in window preview when minimized
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
In an empty WinUI app, set
```C#
AppWindow.TitleBar.BackgroundColor = Colors.Black;
AppWindow.TitleBar.ButtonBackgroundColor = Colors.Black;
```
Minimize the window. Hover over the taskbar icon then hover over the small preview image to get a large preview of the window. At this point the title bar is broken in the following ways.
- The buttons have moved to the left hand size
- The background of the title bar is light gray
- The background of the buttons is white
This is corrected when the window is restored.
It seems like maybe the title bar tries to resize itself in response to the size change on minimize: this would account for the buttons being on the left, but not sure about the color change. Anyway, the title bar should avoid changing on window minimize.
### Why is this important?
Unprofessional user experience
### Steps to reproduce the bug
See description. Minimal code:
```C#
using Microsoft.UI;
using Microsoft.UI.Xaml;
namespace TestMinimizeHover {
public sealed partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
AppWindow.TitleBar.BackgroundColor = Colors.Black;
AppWindow.TitleBar.ButtonBackgroundColor = Colors.Black;
}
}
}
```
### Actual behavior
See description
### Expected behavior
The title bar rendering/layout should not break when the window is minimized.
### Screenshots
_No response_
### NuGet package version
2.5.1
### Windows version
Windows 11 (25H2): Build 26200
### Additional context
_No response_
Contributor guide
Research direction
Reproduce the issue with the minimal C# WinUI app and the AppWindow.TitleBar settings from the report, then inspect the title-bar behavior during taskbar preview after minimization. Done means the title-bar buttons remain correctly positioned and the configured black backgrounds remain visible in the preview, without changing when the window is restored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100