microsoft / microsoft/microsoft-ui-xaml
Glitched UI after restart / change of display adapters
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
Whenever a new display adapter is added e.g. by installing a GPU driver or by disabling and enabling it through device manager, the UI becomes glitched (Text, Images, Backgrounds become invisible).
Most of it can be recovered by quickly dragging the window from the left side and back in a flicky way. Though some of the UI Elements stay glitched.
I have tried to rerender the xaml or programmatically resize the window but it doesn't fix it:
```
var content = MainWindow.Instance.Content;
MainWindow.Instance.Content = null;
MainWindow.Instance.Content = content;
((UIElement)content).UpdateLayout();
((UIElement)content).InvalidateArrange();
((UIElement)content).UpdateLayout();
```
### Why is this important?
My app needs to be able to install / update GPU drivers or restart them without the UI becoming glitched. This is an essential part of my app.
### Steps to reproduce the bug
1. Open any WinUI3 application like the WinUI Gallery or Apple Music.
2. Disable and Enable the current display adapter in device manager until the UI ends up glitched.
3. Resize the window from the left side and see most of the UI getting fixed.
### Actual behavior
The app opens and the UI is normal. After toggling the display adapter the app becomes glitched (Text, Images, Backgrounds become invisible). After resizing most of the UI is restored.
### Expected behavior
The app opens and the UI is normal. After toggling the display adapter the app UI stays functional.
### Screenshots
### NuGet package version
None
### Windows version
Windows 11 (23H2): Build 22631
### Additional context
This has been happening on every WinUI3 version I have used so far.
Contributor guide
Research direction
Reproduce the issue in the WinUI Gallery or Apple Music by disabling and re-enabling the display adapter in Device Manager on Windows 11 23H2, then compare the rendering before and after resizing from the left side. Done means the UI remains functional, with text, images, backgrounds, and other elements visible after the adapter change without manual resizing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100