fix: TitleBar respects ResizeMode.NoResize#1719
Open
xyliteee wants to merge 4 commits into
Open
Conversation
Add ResizeMode check in GetWindowBorderHitTestResult. Return HTNOWHERE when ResizeMode is not CanResize or CanResizeWithGrip. Fixes regression introduced by PR lepoco#1560 where NoResize windows remained resizable.
pomianowski
approved these changes
May 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in TitleBar non-client hit-testing so windows with ResizeMode="NoResize" (or CanMinimize) cannot be resized via border dragging when ExtendsContentIntoTitleBar=True.
Changes:
- Adds a
ResizeModegate toGetWindowBorderHitTestResultto returnHTNOWHEREwhen the window is not resizable.
Comment on lines
+48
to
+52
| var window = Window.GetWindow(this); | ||
| if (window?.ResizeMode != ResizeMode.CanResize && window?.ResizeMode != ResizeMode.CanResizeWithGrip) | ||
| { | ||
| return IntPtr.Zero; | ||
| } |
Return PInvoke.HTNOWHERE explicitly instead of IntPtr.Zero when resize is disabled Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Use existing _currentWindow cache for ResizeMode check
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.
Add ResizeMode check in GetWindowBorderHitTestResult. Return HTNOWHERE when ResizeMode is not CanResize or CanResizeWithGrip. Fixes regression introduced by PR #1560 where NoResize windows remained resizable.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
When a FluentWindow has
ResizeMode="NoResize"(orCanMinimize) and contains a TitleBar withExtendsContentIntoTitleBar="True", the window can still be resized by dragging its borders.This is because
GetWindowBorderHitTestResult()returns resize hit-test values (HTLEFT/HTRIGHT/HTTOP/HTBOTTOMetc.) without checking the window'sResizeModeproperty.Issue Number: N/A
What is the new behavior?
ResizeModecheck at the beginning ofGetWindowBorderHitTestResult()IntPtr.Zero(HTNOWHERE) whenResizeModeis notCanResizeorCanResizeWithGripResizeMode="NoResize"orResizeMode="CanMinimize"can no longer be resized via border draggingCanResizeandCanResizeWithGripOther information
Affected versions: v4.1.0 - v4.3.0 (regression introduced by PR #1560)
Tested on: v4.3.0
Minimal repro XAML: