Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix titlebar color when using backdrop in WPF Window #1122

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

pomianowski
Copy link
Member

@pomianowski pomianowski commented Jun 10, 2024

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Window can have a color in custom titlebar when Show accent colors option is enabled in Windows.

Issue Number: N/A

What is the new behavior?

After enabling Mica backdrop, the titlebar color should be removed.

image

@github-actions github-actions bot added documentation Improvements or additions to documentation themes Topic is related to managing themes controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request navigation Changes to navigation related controls. gallery WPF UI Gallery dotnet release tray labels Jun 10, 2024
@pomianowski pomianowski changed the base branch from main to development June 10, 2024 23:46
@pomianowski
Copy link
Member Author

FYI: @Jay-o-Way, @aquinn39
rel.: microsoft/PowerToys#30206

@jaimecbernardo
Copy link

@pomianowski Awesome work here :)
I've added this fix to microsoft/PowerToys#33458 , while 4.0.0 is not released.
Thank you!

Quick question: Why uint titlebarPvAttribute = 0xFFFFFFFE; and not uint titlebarPvAttribute = 0xFFFFFFFF; ?

@aquinn39
Copy link

aquinn39 commented Jun 20, 2024

Quick question: Why uint titlebarPvAttribute = 0xFFFFFFFE; and not uint titlebarPvAttribute = 0xFFFFFFFF; ?

I got the value (DWMWA_COLOR_NONE) from DWMWA_BORDER_COLOR here. This value appearantly hides the window border, so I thought maybe it might work for DWMWA_CAPTION_COLOR as well, which it did. 0xFFFFFFFF (DWMWA_COLOR_DEFAULT) just resets the title bar colour to the default system behaviour, which means using the accent colour if you have that option enabled - that behaviour actually is documented under DWMWA_CAPTION_COLOR.

Makes me wonder if DWMWA_COLOR_NONE (0xFFFFFFFE) also works on DWMWA_TEXT_COLOR to hide the caption text (not that it's necessary in this case).

@aquinn39
Copy link

aquinn39 commented Jun 20, 2024

Interestingly this behaviour is actually correctly documented in dwmapi.h.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controls Changes to the appearance or logic of custom controls. documentation Improvements or additions to documentation dotnet gallery WPF UI Gallery navigation Changes to navigation related controls. PR Pull request release styles Topic is related to styles themes Topic is related to managing themes tray
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The titlebar on Windows 11 seems strange Part of title bar is still rendered when it should not
3 participants