Repository navigation
Conversation
Introduce modern DWM-driven window chrome: add CaptionTextColorHelper and WindowCaptionAdorner; extend WindowChrome with new enums/properties (FrameMode, CaptionTheme, BackdropType, CornerPreference, caption/border/text colors) and read-only attached properties for per-window state. Rewrite WindowChromeWorker to manage extended-client-area, DWM attributes, backdrop, DPI-aware frame insets, caption buttons and adorner. Expand NativeMethods and Utilities for new DWM/monitor/AppBar APIs. Remove legacy WindowBackdropManager and WindowBackdropType. Integrate with ThemeManager and update Ribbon templates to use WindowChrome extended mode. Add comprehensive unit tests for caption color, frame insets and WindowChrome behavior. Update project includes and internals visibility for tests.
Author
@dotnet-policy-service agree |
Author
|
I opened this PR before the issue was approved because the changes were already largely implemented in three of my personal projects, covering both WinForms and WPF. I consolidated, adapted, and refactored that existing work (with AI assistance) into a unified |
This update fixes caption sizing and hit-testing when a window template or frame state changes. It avoids stale/non-ancestor adorners, keeps automatic SystemFrame chrome from lingering after Fluent removal, preserves implicit default bindings across WindowChrome clones, and makes Ribbon templates fall back to caption height when no title-band is published. A unit test covers the clone/default-binding behavior.
This adds attached CaptionButtonRole metadata plus hover/pressed state properties for custom title-bar button elements. WindowChrome now maps these elements to system non-client hit tests, invokes their action or the matching window command, and tracks state through WM_NCMOUSE messages. It also updates custom-frame docs and unit coverage for the new behavior.
Author
Estimated impactAddressed
Partially addressed
Not addressed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce modern DWM-driven window chrome: add CaptionTextColorHelper and WindowCaptionAdorner; extend WindowChrome with new enums/properties (FrameMode, CaptionTheme, BackdropType, CornerPreference, caption/border/text colors) and read-only attached properties for per-window state. Rewrite WindowChromeWorker to manage extended-client-area, DWM attributes, backdrop, DPI-aware frame insets, caption buttons and adorner. Expand NativeMethods and Utilities for new DWM/monitor/AppBar APIs. Remove legacy WindowBackdropManager and WindowBackdropType. Integrate with ThemeManager and update Ribbon templates to use WindowChrome extended mode. Add comprehensive unit tests for caption color, frame insets and WindowChrome behavior. Update project includes and internals visibility for tests.
Fixes #11973 11973
Description
Introduces modern DWM-driven window chrome integration for WindowChrome:
Customer Impact
Enables apps to opt into native Mica/Acrylic backdrops, rounded corner preference, and DWM-driven caption/border theming without custom chrome hacks.
Regression
No known regressions have been observed when the new opt-in properties are not used. Because this change substantially updates
WindowChromeWorker, additional review and testing are still needed for existing custom-chrome scenarios.Testing
Added unit tests for the managed property and frame-inset behavior. Native DWM behavior, rendering, DPI transitions, and caption-button interaction were manually verified on Windows 11 (including dpi and high contrast theme).
Risk
Touches
WindowChromeWorkerinternals broadly. The changes are covered by unit tests where practical and are gated behind new opt-in properties. Some behavior, including native DWM integration, rendering, DPI transitions, and caption-button interaction, requires manual validation on supported Windows configurations.Microsoft Reviewers: Open in CodeFlow