FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(window): restore WindowChrome resize border thickness when restored from Maximized (closes #246) by omid-io · Pull Request #248 · ghost1372/HandyControls · GitHub

fix(window): restore WindowChrome resize border thickness when restored from Maximized (closes #246) - #248

Merged
ghost1372 merged 1 commit into
ghost1372:developfrom
omid-io:fix/window-resize-after-restore
Sep 5, 2026
Merged

ghost1372 merged 1 commit into
ghost1372:developfrom
omid-io:fix/window-resize-after-restore

Conversation

omid-io commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #246 (and upstream #1793) where an hc:Window initialized with WindowState="Maximized" could not be resized and lacked resize cursor affordances after being restored to Normal.

Root Cause

  1. When WindowState == WindowState.Maximized at load time, OnLoaded sets chrome.ResizeBorderThickness = new Thickness(0) to prevent edge stretching while maximized.
  2. When the window is subsequently restored (via window restore buttons, snap layouts, Win32 SC_RESTORE, or title-bar drag), OnStateChanged updated BorderThickness and NonClientAreaHeight, but never restored WindowChrome.ResizeBorderThickness.
  3. Furthermore, OnPropertyChanged is not reliably called by WPF during Win32-initiated state changes (e.g., system commands or snap gestures), leaving ResizeBorderThickness stuck at 0.

Solution

  1. In Window.cs, invoked ApplyWindowChrome(WindowState) inside OnStateChanged(EventArgs e) so that every transition back to WindowState.Normal dynamically re-applies the proper resize border thickness (6px) or clears it if Maximized / NoResize.
  2. In Window!.cs, ensured ResizeMode == ResizeMode.NoResize is explicitly honored when calculating chrome.ResizeBorderThickness.

Verification

  • Built HandyControl_Net_GE45.csproj targeting net8.0-windows cleanly with 0 compilation errors.

Copy link
Copy Markdown
Owner

Thank you

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hc:Window cannot be resized if it starts with WindowState=Maximized and is then restored

2 participants


Back | FazBrowse Home | New Git URL