I just extended the drag/drop capabilities of my app. I was expecting this to require some surgery on the code, but in the end it was relatively simple, just requiring adding two event handlers, one very short, and most of the code in the other was just for creating the drag-picture.
The two event handlers were:
DragRow - for the source listbox
DropObjectOnRow - for the taget listbox
This was for dragging a row from a listbox, dropping it on a row in an entrely different listbox (that is, the target listbox has a different purpose in the app than that of the listbox of the dragged row), and having the target listbox take some action.
This all worked OK, with this line of code:
drag.Text = "some string"
where “some string” had the required data to tell the target what to do. However, thinking about it caused me to then try dropping some random text from a TextArea onto the target listbox, which lo-and-behold accepted it and was not happy. To avoid this, I moved to using this:
drag.RawData("abcd") = "some string"
and looking for that raw-data on the receiving side. This technique I already use for all other drag/drop in my app, but the examples didn’t appear to imply that this could be done in this case - and, en plus, RawData and RawDataAvailable do not show up in the debugger as DragItem properties.
So far so good. But in addition to those properties not being visible in the debugger, it also seems that the drag text must be set - even if not used. It seems the drag-item must have its Text property set to something, even an empty string, otherwise the DropObjectOnRow does not fire on the target.
Anyone know why this might be? Seems unnecessary to me.