Skip to content

fix: SetWindowChrome ResizeBorderThickness for non-resizable modes#1728

Open
xyliteee wants to merge 1 commit into
lepoco:mainfrom
xyliteee:patch-1
Open

fix: SetWindowChrome ResizeBorderThickness for non-resizable modes#1728
xyliteee wants to merge 1 commit into
lepoco:mainfrom
xyliteee:patch-1

Conversation

@xyliteee

@xyliteee xyliteee commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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?

PR #1719 added a ResizeMode check in TitleBar.GetWindowBorderHitTestResult() to prevent resizing when ResizeMode is NoResize or CanMinimize. However, this was only a partial fix — the root cause is in FluentWindow.SetWindowChrome(), where ResizeBorderThickness is incorrectly set to 4 for CanMinimize mode.

Because WindowChrome handles WM_NCHITTEST independently of TitleBar's HwndSourceHook, the TitleBar fix alone cannot fully prevent resizing in CanMinimize mode. The window borders remain resizable via WindowChrome.ResizeBorderThickness.

Related: #1719

What is the new behavior?

  • FluentWindow.SetWindowChrome() now only sets ResizeBorderThickness = 4 when ResizeMode is CanResize or CanResizeWithGrip
  • CanMinimize and NoResize now correctly get ResizeBorderThickness = 0, preventing unintended window resizing at the WindowChrome level
  • This is the proper fix for the issue addressed in fix: TitleBar respects ResizeMode.NoResize #1719

Other information

This PR supersedes / completes the fix started in #1719. The previous PR worked around the symptom in TitleBar; this PR fixes the root cause in FluentWindow.

Minimal repro XAML (before fix — window borders remain resizable):

<<ui:FluentWindow ResizeMode="CanMinimize" ExtendsContentIntoTitleBar="True">
    <ui:TitleBar/>
</ui:FluentWindow>

@xyliteee xyliteee requested a review from pomianowski as a code owner June 5, 2026 10:24
@github-actions github-actions Bot added controls Changes to the appearance or logic of custom controls. PR Pull request dotnet release labels Jun 5, 2026
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. dotnet PR Pull request release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant