Drag N Drop

Improved DragDropManager – Source code

The DragDropManger has been a very handy class for me in couple of my projects. Since my last post I made some changes to the interfaces (IDragSourceAdvisor, IDropTargetAdvisor) and also to DragDropManager. There are no major changes except for a few method additions in the interfaces. These methods make it even more flexible. Changes to [...]

Making the Scrollbar work (with DragDropManager)

This post is a corollary to a set of posts I did on the DragDropManager component. If you have been using the DragDropManager with a ListBox, you may have encountered an issue where you are not able to scroll using the ScrollBar. There are couple of reasons for this: I have setup Preview events on [...]

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] [...]

Drag & Drop with attached properties – Part 3

In my previous blog posts (Part 1, Part 2) on this topic, I have discussed how you can add drag-drop behavior to your application using attached properties. This greatly simplifies the event hook-up, keeps the XAML clean and literally gets rid of code-behind. However the previous version did not support the scenario where you are [...]

Drag & Drop with attached properties – Part 2

In my previous post on this topic, I gave a quick overview of how Drag and Drop can be accomplished using attached properties. To review, here are the key elements of the implementation: DragDropManager – top level class that exposes the attached properties (DragSourceAdvisor, DropTargetAdvisor); does all the DnD plumbing and fires methods on the [...]

Drag & Drop with attached properties

I am a big fan of attached properties and I think it is one of the coolest innovations in WPF. Once you understand the basics of using and creating attached properties, lot of the common activities that typically require some code-behind can be pushed to a class that implements an attached property or a set [...]