Hello.I'm using the Drag & Drop framework with many DragSources and many DropTargets.These are regularily newly instantiated when the user is filtering or updating a list of elements of which each element is a DragSource that can be dragged onto a list of DropTargets. When the list of DropTargets which is a list of UserControls is cleared and refilled I'm using the Unload event of the UserControl to set IsDropTarget = false. This makes the DragDropManager unregistering the DropTarget as expected. When trying the same with IsDraggable on the DragSources the DragDropManager does not unregister the DragSource properly an keeps on holding a reference in its internal list. So the internal list is constantly growing and the drag drop experience gets more and more stuttering.After I downloaded the source code an changed UnregisterDragSource to:
protected internal static void UnregisterDragSource(UIElement element){ if (element != null) { element.RemoveHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnMouseLeftButtonDown)); if (Instance._dragSources.Contains(element)) { Instance._dragSources.Remove(element); } }}
changed the internal list of DragSources is cleaned up as I would expect it.Is your implementation a bug? Or is it by design and I'm missing something?Best regards Holger
Hello Holger,
Thank you for pointing us to this issue. The fix you have applied is something we need to add indeed. We'll provide a fix for the next SR.
Regards.Plamen.
Holger,
The fix is in the latest service release and this is available for download from the My Keys & Downloads page.
Let us know if you have any questions.