Exception:指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接。

报错信息 1
InvalidOperationException: 指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接。
StackTrace:
   在 System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   在 System.Windows.FrameworkElement.AddLogicalChild(Object child)
   在 System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)
   在 __ScriptExecution.__ntff57zc.<>c__DisplayClass0_0.<Exec>b__41()
   在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   在 System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

版本:1.45.5 2026-07-01 00:35 Microsoft Windows NT 10.0.26200.0