I have a ListBox that implements drag & drop: it works for single items (selecting an item then dragging it on top of another will put it in the right spot), but when selecting multiple items (using shift or ctrl) I have not been able to make it work.
My main issue is I don't know how the DragDrop.DoDragDrop
function handles batches of items. It works for single items (specify the FrameworkElement, then the data format and the data, finally the drag effects). But if I have multiple items how do I use DoDragDrop
? Since I have to specify a format wouldn't it always expect a single instance of that format? I have several 'Entities' I want to drag and drop, how do I tell DragDrop.DoDragDrop
to accept all that data in one operation?
It works perfectly when I am passing just one DataObject
to the DoDragDrop
method, but I need to find a way to pass multiple objects in one call.
So far I've tried creating multiple DataObjects and tried creating an array or list to add to DoDragDrop
as its data but that doesn't work. I also tried looping DoDragDrop
so it gets called once for every item I'm dragging and that didn't work either.