Skip to content

Fix: ResizeMode="NoResize" ignored in FluentWindow after PR #1560#1714

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-fluentwindow-resizing-issue
Draft

Fix: ResizeMode="NoResize" ignored in FluentWindow after PR #1560#1714
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-fluentwindow-resizing-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented May 13, 2026

PR #1560 introduced TitleBar.WindowResize.cs for border resize hit-testing, but did not guard against ResizeMode="NoResize" or ResizeMode="CanMinimize". The Math.Max(2, …) floor in the DPI helpers ensured the border hit zone was always ≥2px — overriding FluentWindow.SetWindowChrome()'s ResizeBorderThickness = default — so windows remained draggable regardless of ResizeMode.

Pull request type

  • 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?

Setting ResizeMode="NoResize" or ResizeMode="CanMinimize" on a FluentWindow has no effect — the window edges still show resize cursors and can be dragged to resize.

What is the new behavior?

  • GetWindowBorderHitTestResult checks the parent window's ResizeMode before performing any border hit-testing.
  • If ResizeMode is NoResize or CanMinimize, it returns HTNOWHERE immediately, suppressing resize cursors and drag-resize entirely.
private IntPtr GetWindowBorderHitTestResult(IntPtr hwnd, IntPtr lParam)
{
    if (
        _parentWindow is Window parentWindow
        && parentWindow.ResizeMode is ResizeMode.NoResize or ResizeMode.CanMinimize
    )
    {
        return (IntPtr)PInvoke.HTNOWHERE;
    }
    // ...
}

Other information

Regression introduced by #1560.

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
…esting

Agent-Logs-Url: https://github.com/lepoco/wpfui/sessions/0c1b6b29-703c-4891-a319-5c4b5ccf0ffb

Co-authored-by: pomianowski <13592821+pomianowski@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix FluentWindow resizing issue with ResizeMode property Fix: ResizeMode="NoResize" ignored in FluentWindow after PR #1560 May 13, 2026
Copilot AI requested a review from pomianowski May 13, 2026 13:12
@chucker
Copy link
Copy Markdown
Collaborator

chucker commented May 14, 2026

6250edc fixes it for Wpf.Ui.Controls.MessageBox and for an example roughly like the one in #1691.

However, in TitleBar, the maximize button still works, and shouldn't.

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.

Cannot disable resizing in FluentWindow

3 participants