enjoy life and code

Windows 11 Snap Layouts WPF 支持进展

Init 2022/1/13

WPF 使用 WindowChrome 后需要自己处理最大最小化但是无法触发 Windows 11的Snap Layouts 功能,现在主要的解决方案就是劫持 WM_NCHITTEST 事件,返回 HTMAXBUTTON = 9,目前我在 .net framework 4.5.2 上是无法完美解决,只有在全屏的时候才会调出 Snap Layouts,可能和另一个Windows 的 Size 事件有关暂时原因未知

鼠标HitTest事件 WM\_NCHITTEST 消息 (Winuser.h) - Win32 apps | Microsoft Docs

1. Should WPF add the new theme for Windows11 style? · Issue #4749 · dotnet/wpf (github.com)

2. Add support for Windows 11 "Snap Layout" to the custom title bar (WindowChrome) · Issue #4825 · dotnet/wpf (github.com)

  1. MahApps Windows 11 integration · Issue #4140 · MahApps/MahApps.Metro (github.com)

其它项目,electorn 最新版本已经支持,Firefox 看起来没打算做,UWP 原生就可以。

Electorn feat: enable windows control overlay on Windows by mlaurencin · Pull Request #29600 · electron/electron (github.com)

VSCode VS Code's maximize button doesn't trigger Snap Layouts in Windows 11 · Issue #127449 · microsoft/vscode (github.com)

Firefox 1718629 - Windows 11 Snap Layouts menu doesn't appear while hovering (mozilla.org)

Windows Terminal Snap Layouts Support: WM\_NCHITTEST should return HTMAXBUTTON, HTMINBUTTON, ... for caption buttons · Issue #9443 · microsoft/terminal (github.com)

UWP 自定义标题栏 Window.SetTitleBar(UIElement) Method (Windows.UI.Xaml) - Windows UWP applications | Microsoft Docs

添加新评论