Skip to content

Fix native Windows maximize for the Avalonia main window #4749

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
Drag-and-Drop-resizing
May 12, 2026
Merged

Fix native Windows maximize for the Avalonia main window #4749
Gabriel Dufresne (GabrielDuf) merged 2 commits into
mainfrom
Drag-and-Drop-resizing

Conversation

@GabrielDuf
Copy link
Copy Markdown
Contributor

Summary

  • Aero Snap drag-to-top, Win+Up, and DWM maximize animations were broken on the Avalonia main window on Windows — dragging the window to the top of a screen would make it vanish off-screen and force an app restart.
  • Root cause is upstream: Avalonia 12 #21160WindowDecorations.BorderOnly + ExtendClientAreaToDecorationsHint=true strips WS_CAPTION / WS_THICKFRAME from the window style, which makes DWM disable Aero Snap and all maximize/minimize/restore animations.

Cross-platform safety

All new Windows-only code is gated by OperatingSystem.IsWindows() or only reachable through the WndProc hook that's installed under that guard. NativeMethods P/Invokes are pure declarations that compile on any TFM and are never invoked on macOS / Linux. The macOS and Linux branches of SetupTitleBar are unchanged. The simplified WindowStateProperty observer evaluates identically on non-Windows (the field that was removed was always null there).

@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 2de7aae into main May 12, 2026
3 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the Drag-and-Drop-resizing branch May 12, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants