refactor(工具栏): 将BorderTools从Border改为Popup控件并优化显示逻辑

重构工具栏中的BorderTools控件,将其从Border改为Popup控件,并添加自定义位置回调
优化显示/隐藏逻辑,使用IsOpen属性替代Visibility控制
更新相关动画效果调用为对应的Popup版本
调整UI样式和布局,提升视觉一致性
This commit is contained in:
PrefacedCorg
2026-05-02 15:55:37 +08:00
parent 09713f70bf
commit 35c8e980f8
7 changed files with 74 additions and 59 deletions
@@ -99,10 +99,15 @@ namespace Ink_Canvas.Controls.Toolbar
visible = cfg.Visible;
try
{
var menuElement = host.Window.FindName(item.MenuPanelName) as FrameworkElement;
if (menuElement != null)
var menuElement = host.Window.FindName(item.MenuPanelName);
if (menuElement is System.Windows.Controls.Primitives.Popup popup)
{
menuElement.Visibility = visible ? Visibility.Visible : Visibility.Collapsed;
popup.IsOpen = visible;
LogHelper.WriteLogToFile($"ToolbarRegistry: 菜单 Popup [{item.MenuPanelName}] -> {(visible ? "Open" : "Closed")}", LogHelper.LogType.Info);
}
else if (menuElement is FrameworkElement fe)
{
fe.Visibility = visible ? Visibility.Visible : Visibility.Collapsed;
LogHelper.WriteLogToFile($"ToolbarRegistry: 菜单 [{item.MenuPanelName}] -> {(visible ? "Visible" : "Collapsed")}", LogHelper.LogType.Info);
}
else