[DarkMode]The Form1 title bar change to white color after change the ShowInTaskbar property
.NET version
.NET 10.0.100-preview.2.25118.3
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No, also repro in .NET 9.0 which it started to be supported.
Issue description
The Form1 title bar change to white color after change the ShowInTaskbar property.
Steps to reproduce
- Create a winforms .NET Core project with a button control.
- Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in Program.cs file.
- Double click button control and add below code to button click event. `this.ShowInTaskbar = !this.ShowInTaskbar;
- Build and run.
- Click button control.
More Info:
- This issue also repro in FormShowinTaskbar test in WinformsControlTest app.
https://github.com/user-attachments/assets/92e54b94-a73b-4524-bec7-cfaef740d089
This issue is now marked as "help wanted", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 180 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
My assumption is, that all of those property causes a handle recreation, and I guess that then the dark-mode request does not get send off.
My assumption is, that all of those property causes a handle recreation, and I guess that then the dark-mode request does not get send off.
My guess is to have handle recreation deferred to a separate specific method that is then used everywhere a handle recreation is needed that then honors the mode request as well so then it would fix this issue.
Still repro in the latest .NET 10 SDK build: 10.0.100-preview.6.25311.107, so reopen the issue.
https://github.com/user-attachments/assets/b85aea93-7ff4-4bcf-8398-0d572b7e146b