winforms icon indicating copy to clipboard operation
winforms copied to clipboard

[DarkMode]The Form1 title bar change to white color after change the ShowInTaskbar property

Open MelonWang1 opened this issue 10 months ago • 4 comments

.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.

Image

Steps to reproduce

  1. Create a winforms .NET Core project with a button control.
  2. Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in Program.cs file.
  3. Double click button control and add below code to button click event. `this.ShowInTaskbar = !this.ShowInTaskbar;
  4. Build and run.
  5. Click button control.

More Info:

  1. This issue also repro in FormShowinTaskbar test in WinformsControlTest app.

https://github.com/user-attachments/assets/92e54b94-a73b-4524-bec7-cfaef740d089

MelonWang1 avatar Feb 20 '25 09:02 MelonWang1

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.

KlausLoeffelmann avatar Feb 25 '25 19:02 KlausLoeffelmann

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.

AraHaan avatar May 02 '25 12:05 AraHaan

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

Syareel-Sukeri avatar Jun 13 '25 06:06 Syareel-Sukeri