Implementing drag-and-drop

Drag-and-drop functionality is common in applications, where one object is held down and dragged to some other object with the mouse. This approach is not as common as it used to be, especially with a mouse, because it requires hand coordination skills. Recent tablet devices are touch enabled, where drag and drop makes a lot of sense. As a general rule, always provide an alternative to drag-and-drop. That said, this can be a handy feature for advanced users.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create an application that allows dragging elements (circles and rectangles) from one part of the window to another container within the same window, showing the necessary steps to get drag-and-drop ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.