microsoft / microsoft/microsoft-ui-xaml
[WinUI3] Binding to Foreground gets broken when element is out of the visual tree.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
A binding between the Foreground of a custom control and the background of a border gets broken when the custom control is removed and added again to the visual tree.
### Why is this important?
Controls don't change the foreground correctly when the theme is changed.
### Steps to reproduce the bug
[App14.zip](https://github.com/user-attachments/files/22755925/App14.zip)
- Unzip project App14
- Open App14.sln in Visual Studio 2022
- Run project
- Change "Theme" combo-box and notice the bound brush changes accordingly, following theme foreground
- Now press "Add/Remove Custom Control from visual tree"
- Change theme.
- Press button again (notice the brush is not the correct)
### Actual behavior
_No response_
### Expected behavior
_No response_
### Screenshots
### NuGet package version
WinUI 3 - Windows App SDK 1.8.1: 1.8.250916003
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.