[Bug] hc:Window 初始化时点击最大化按钮会抛出 ElementNotEnabledException

Author: ABA2396Created Oct 7, 2025Updated Jun 22, 2026

Describe the bug

在使用 HandyControl 的 hc:Window 作为主窗口时,窗口刚初始化时,点击最大化按钮会抛出 ElementNotEnabledException。 测试时还发现,即使设置 IsEnabled="False",最大化按钮依然可以点击(最小化和关闭按钮会被禁用),但主要问题是初始化阶段最大化按钮可点且会报错。

Steps to reproduce the bug

  1. 在 XAML 中使用 hc:Window 作为主窗口
  2. 启动程序,在窗口刚显示时点击最大化按钮
  3. (附带问题)如果设置 IsEnabled="False",最大化按钮依然可用,最小化和关闭按钮会被禁用。

Screenshots

https://github.com/user-attachments/assets/24aee6af-cc92-40d1-8920-372ed8cf5f57

Image

https://github.com/user-attachments/assets/17e8b5e5-a128-4511-a9d2-df0235bd79ab

https://github.com/user-attachments/assets/9791ceb5-b1a0-4836-ad00-4e19242337e8

Framework type

.Net 8.0

Additional context

PackageReference Include="HandyControls" Version="3.5.2" Visual Studio 2026 insiders