Skip to content

[Dark Mode] Some rows/columns and ColumnHeader/RowHeader in the DataGridView control have incorrect colors  #11893

Open

Description

@Philip-Wang01

.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: #11857

Issue description

Button and combobox types rows/columns and ColumnHeader/RowHeader in the DataGridView control have incorrect colors
image

Steps to reproduce

  1. Create a WinForms .NET Core application with DataGridView control.
  2. Enable DarkMode by Application.SetColorMode(SystemColorMode.Dark) in program.cs file.
  3. Add different types of columns to the DataGridView, such as button, checkbox and combobox.
  4. Run the application.
  5. Observe the result.

Activity

  1. added
    untriaged
    on Aug 16, 2024
  2. memoarfaa commented on Aug 16, 2024

    @memoarfaa

    @Philip-Wang01
    Temporary solution is set "FlatStyle" to "FlatStyle.Flat"

    I notice that Any normal Button has property FlatStyle set to "FlatStyle.Standard" or has "UseVisualStyleBackColor" set to "true"
    will use light Color Mode

    So any drawing related to Visual style will be in Light Mode like (ButtonRenderer , VisualStyleRenderer, UseVisualStyleBackColor, FlatStyle.Standard)

    The WinForms team has no intention of supporting Dark Mode Visual style in .NET SDK 9 according to @KlausLoeffelmann statements here he say it will be completed in .NET SDK 10.

    #10985 (comment)

    You can see the difference between Buttons in this images on use Light ButtonRenderer and another use Dark ButtonRenderer

    Light Mode ButtonRenderer

    2024-08-16_11-59-20

    Dark Mode ButtonRenderer

    2024-08-16_12-18-11

  3. KlausLoeffelmann commented on Aug 17, 2024

    @KlausLoeffelmann
    Member

    The WinForms team has no intention of supporting Dark Mode Visual style in .NET SDK 9 .

    Well, to be fair, we had every intention possible. And we all know of course, that the VisualStylesMode features, although technically a separate feature, is very closely related to the dark mode in a lot of areas - this just being one of them. But at one point we/I also need to accept, that Visual Styles might have introduced incompatibilities, where we cannot with good conscience accept something that we passionately want to let jeopardize the stability of the system. We're not saying that that would have happened. But we were "just" not sufficiently sure. And even this being an Experimental feature doesn't mean, it does not need to meet a min bar for stability and safety AND we are sure about that it has all that. Did it have it? Yeah, very likely. Were we 100% sure? No. That's why it was the right decision to slip it into 10. And we always knew, with the existing workload, that this could happen, and we reserved the right to slip it even up to the very end: We aimed and work hard for making it happen as an Experimental feature with the primary goal to collect feedback - NOT to use it in production until the very last minute. We could have made that call in May and say, no, it's too close, other work items with higher priority just made it necessary to postpone. And we definitely WOULD have made that call earlier, had that feature not been conceptualized as an experimental feature to begin with.

    So, Dark Mode made it, Visual Styles did not.

    It was the right call. @JeremyKuhne, @merriemcgaw.

  4. added
    area-DarkMode
    on Aug 20, 2024
  5. added
    🚧 work in progress
    on Aug 25, 2024
  6. jdarwood007 commented on Jan 14, 2025

    @jdarwood007

    A workaround seems to be to set EnableHeadersVisualStyles on the DataGridView to false.

  7. removed
    untriaged
    on Apr 22, 2025
  8. added theissue type on Apr 22, 2025
  9. added this to the 10.0 Preview4 milestone on Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

🚧 work in progressarea-DarkMode

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions