dotnet / dotnet/winforms

[DarkMode] Button Click not working when Swithch Window OS ColorMode

Open
#13,636 1 comment 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
area-DarkMode
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

The latest main branch of Winforms "10.0.0-preview.7.25318.105"

### Did it work in .NET Framework?

Not tested/verified

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

This is an issue reproduce on release/10.0-preview6

### Issue description

When Application.SetColorMode set to SystemColorMode.System and change OS Color Mode the Button Click is no longer work;

### Steps to reproduce

1- Enable Dark mode by adding below code lines in the Program.cs file under WinformsControlsTest project
#pragma warning disable WFO5001
Application.SetColorMode(SystemColorMode.System);
#pragma warning restore WFO5001

2- Open Settings -> Personalization ->Colors->Choose your Mode swithch OS Colors

https://github.com/user-attachments/assets/20f7ad06-18e3-40ab-86df-cd7e1b906436

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.