views:

42

answers:

1

I have a WPF 4 app which I want to enable drag and drop with, currently I have it working with a basic drag and drop implementation, but I have found that it would be much better if, instead of the mouse cursor changing over to represent the move operation, I could use an image underneath my finger.

I cannot seem to find any samples or doco that has this working out of the box, so Im assuming Im going to have to build it custom... any ideas?

My drag and drop operation is initiated inside a custom user control, so I will need to insert a visual element into the visual tree and have it follow my finger around, perhaps I should enable the ManipulationDelta event on my main window, check for a boolean then move the item around?

Im just throwing ideas around at this point, any help or ideas would be greatly appreciated.

Cheers, Mark

A: 

There is an example of using a custom drag cursor at http://blogs.msdn.com/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx. You can handle the GiveFeedback event and change the mouse cursor, but to use a custom Visual the author creates a new Window and updates the position on QueryContinueDrag.

Quartermeister
I did actually read that article, and the issue I can see is that the mouse cursor can only be set to a `System.Windows.Input.Cursor` which I dont see how to use a UIElement... (which I want to have animations and more). Thanks for the help though. I was actually thinking of using a custom version of this library: http://dotnetslackers.com/ado_net/re-191632_generic_wpf_drag_and_drop_adorner.aspx
Mark
@Mark: I think the article addresses that in the section "Next scenario: Getting fancy and using the Visual we are dragging for feedback [instead of a cursor]" by creating a separate Window to follow the mouse like a cursor. I haven't actually tried it, though.
Quartermeister
cool ill take a look at that, Ive got to stop skimming so many articles
Mark