From 01fea07f3338288b58b5cd9fe6241df9167702be Mon Sep 17 00:00:00 2001 From: Christian Giesswein Date: Fri, 15 Nov 2024 11:18:59 +0100 Subject: [PATCH] ThreadingProblem --- src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs b/src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs index 5b9aa963..ecfac16e 100644 --- a/src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs +++ b/src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs @@ -27,6 +27,12 @@ public DropTargetAdorner(UIElement adornedElement, IDropInfo dropInfo) public void Detatch() { + if (!m_AdornerLayer.Dispatcher.CheckAccess()) + { + m_AdornerLayer.Dispatcher.Invoke(this.Detatch); + return; + } + this.m_AdornerLayer.Remove(this); }