Site Logo

Pixel-in-Gene

Exploring Frontend Development with Design / Graphics / Technology

Drag & Drop with attached properties - Part 4

In Part 3 of this series I made some changes which allowed Drag and Drop across Windows and Applications. Although it works well, someone pointed out in the comments to that post, that the drag-point was always at (0,0) even though the user may have clicked somewhere inside the element (ie. not at the [0,0] position).

Thanks to Lester Lobo, now that has also been fixed! He has blogged about it here. I had a quick look at some of his changes and I am glad to have learnt something new. Firstly you can associate supplementary data with the IDataObject simply by calling IDataObject.SetData() more than once. This is how the drag-offset is transported by calling IDataObject.SetData(“point”, Point(<the-drag-offset>)); To make this work Lester also added some extra interface methods to both IDragSourceAdvisor and IDropTargetAdvisor.

Since I released the 3rd version of this library, I have made some minor code-changes in my own copy. I’ll merge those with Lester’s changes and publish in a subsequent blog entry. The library has gotten much better now!

Drag & Drop with attached properties - Part 4
Pavan Podila
Pavan Podila
December 8th, 2006