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

报错信息 1
InvalidOperationException: 指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接。
StackTrace:
   在 System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   在 System.Windows.FrameworkElement.AddLogicalChild(Object child)
   在 System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)
   在 DynamicClass.cc.<初始化>d__12a.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 DynamicClass.a.<OnWindowCreated>d__2.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 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.44.5 2025-08-26 18:48 Microsoft Windows NT 10.0.22621.0