Skip to content

Fix The Form1 title bar change to white color when set the RightToLeft to Yes in PropertyGrid control - #14742

Merged
LeafShi1 merged 6 commits into
dotnet:mainfrom
Sathish-087:Fix_Issue_12582
Aug 13, 2026
Merged

Fix The Form1 title bar change to white color when set the RightToLeft to Yes in PropertyGrid control#14742
LeafShi1 merged 6 commits into
dotnet:mainfrom
Sathish-087:Fix_Issue_12582

Conversation

@Sathish-087

@Sathish-087 Sathish-087 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #12582, #12992

Proposed changes

  • Re-apply the DWMWA_USE_IMMERSIVE_DARK_MODE window attribute during form handle recreation.
  • Update SetFormTitleProperties() to restore dark mode title bar settings when a top-level form handle is recreated.
  • Fix an issue where changing ShowInTaskbar or RightToLeft causes the form title bar to revert to the light theme while the rest of the form remains in dark mode.

Customer Impact

  • Ensures dark mode is consistently preserved for top-level forms after handle recreation scenarios.
  • Fixes title bar theme mismatches that occur when changing ShowInTaskbar or RightToLeft at runtime while dark mode is enabled.

Regression?

  • No

Risk

  • Low. The change only reapplies an existing DWM dark mode attribute during handle recreation and is executed only for top-level forms with dark mode explicitly requested.

Screenshots

Before

FormTitleIssueDemo.mp4

After

FormTitleAfterFixDemo.mp4

Test methodology

Accessibility testing

  • No accessibility changes introduced.
  • This change only restores an existing DWM window attribute during handle recreation and does not modify UIA behavior, keyboard navigation, or control accessibility.

Test environment(s)

  • Windows 11
  • .NET SDK: 11.0.100-preview.5.26302.115
Microsoft Reviewers: Open in CodeFlow

@Sathish-087
Sathish-087 requested a review from a team as a code owner July 15, 2026 06:37
Comment thread src/System.Windows.Forms/System/Windows/Forms/Form.cs Outdated
@KlausLoeffelmann

Copy link
Copy Markdown
Member

@Sathish-087, do you have the permission to merge this?
If yes, please merge at your earliest convenience!
Thanks!!

@Sathish-087

Copy link
Copy Markdown
Contributor Author

Hi @KlausLoeffelmann ,
I don't have merge access for this repository, so I'm unable to merge the PR.

@LeafShi1
LeafShi1 merged commit fd595a1 into dotnet:main Aug 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DarkMode]The Form1 title bar change to white color when set the RightToLeft to Yes in PropertyGrid control

3 participants