Exception:指定的索引已经在使用。请先在指定的索引处断开 Visual 子级。

报错信息 1
ArgumentException: 指定的索引已经在使用。请先在指定的索引处断开 Visual 子级。
--Message: 指定的索引已经在使用。请先在指定的索引处断开 Visual 子级。
StackTrace:
   在 System.Windows.Media.VisualCollection.set_Item(Int32 index, Visual value)
   在 System.Windows.Controls.UIElementCollection.set_Item(Int32 index, UIElement value)
   在 __ScriptExecution.__ohd6jsoh.MainWin.StartEdit(DockPanel row, TextBlock tb, TodoItem it, Int32 index, String key)
   在 __ScriptExecution.__ohd6jsoh.MainWin.<>c__DisplayClass31_0.<BuildTodoRow>b__2(Object s, MouseButtonEventArgs e)
   在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   在 System.Windows.Input.InputManager.ProcessStagingArea()
   在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   在 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 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-09-16 14:10 Microsoft Windows NT 10.0.19044.0