dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.41k stars 980 forks source link

[Dark Mode] Control pops up dialogs and MessageBox window are not in Dark mode when DarkMode enabled #11896

Open Philip-Wang01 opened 2 months ago

Philip-Wang01 commented 2 months ago

.NET version

.NET SDK 9.0.100-rc.1.24415.1 + build private dll form winforms repo release/9.0 branch

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

This is a new feature Dark Mode: https://github.com/dotnet/winforms/pull/11857

Issue description

Control pops up dialogs and MessageBox window are not in Dark mode when DarkMode enabled

ColorDialog: image

FontDialog: image

MessageBox: image

Steps to reproduce

  1. Create a WinForms .NET Core application.
  2. Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in program.cs file.
  3. Add three button controls to the form designer.
  4. Add click events to open FontDialog, ColorDialog and MessageBox for each of the three buttons.
  5. Run the application.
  6. Click each of the three buttons and observe the color of the new dialog.
KlausLoeffelmann commented 2 months ago

This is currently by design. This is nothing, that we would address right now, even if we could potentially change that. For type editors, we need to address them over time anyway to make dark mode work for VS. My suggestion is that we would port those then back to the runtime and make them dark mode aware. But this has nothing to do with the dark mode not working in this case, this is more that we would need to introduce dark mode ability in our own infra over time. So, those are not bugs but actually to do issues.

When dialogs are triggered directly by the system, however, that it's not in our hands. Windows does the same, like this dialog in the File Explorer. Thay are migrating to dark mode or a new UI approach over time:

Image

So: Color Dialog and Font Dialog, we could potentially address. The MessageBox is what it is. We could think about a way of styling the TaskDialog - I haven't looked into that, yet.

memoarfaa commented 2 months ago

@KlausLoeffelmann

So: Color Dialog and Font Dialog, we could potentially address. The MessageBox is what it is. We could think about a way of styling the TaskDialog - I haven't looked into that, yet.

Are you Sure that The MessageBox is what it is and we cannot apply dark mode to it ?

https://github.com/user-attachments/assets/e0b1f9bd-4bbd-4869-a53b-57d43a0f60d5

dotnet-policy-service[bot] commented 1 month ago

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!