Drag & Drop Operations

Hi there. I'm on charge of implementing Drag & Drop operation for my WPF client. I found a class DragDrop which does it. I have a couple of questions to whom which used it.

1. How do I replace a drag image I know hoe to disable default cursors - from within QuearyContinue. Effectively I need to copy a bit of my screen and use it as a drag image - so I’m looking for smth. like bit blaster in WPF if exists (this problem get solved when I go for physical moving of the UI element I drag).

2. It appears that MouseMove event isn't firing until the drag operation gets completed (which stands to reason). That means that I have to handle all GUI operations happening during my drag operation, using DragOver handler (which by the way doesn't have corresponding overwritten method). So if I drag over a number of different UIElements I still have to use tunnelling (unless I want to implement my logic within every possible UI element under which I drag)

3. Does it worth the hassle :) I managed to implement 'DnD' like behaviour, using routed events in conjunction with MouseEnter. I can catch it for any elements, laid beneath 'the dragger', so - what can I gain from using DnD if I have no req. for handling external drag sources

Thanks\



Answer this question

Drag & Drop Operations

  • Pratap

    1. You can use create a new element (a Rectangle) and paint it with a VisualBrush sourced by the element which you're trying to indicate the drag operation for.
    2. I haven't experimented enough with DnD, but what you're proposing seems to make the most sense assuming the parent element which will handle the drag/drop knows everything it needs to about its child elements. Keep in mind that if you assume you know everything about your children up front you might have a problem extending support later. Kinda like baking all the behavior into a base class rather than calling a virtual method that can be overridden later.
    3. I'm sure you can implement some rudimentary DnD behavior yourself, especially if it's intra-application. If you needed to communicate outside of the application (i.e. with other Windows apps) then obviously "true" DnD is the only way to go.

    HTH,
    Drew


  • 83kwan

    Alex, can you explain what you did creating DnD like behavior using routed events.

    I am trying to build an Adorner class that has an object in a layer that follows the mouse around, but doesnt otherwise respond to mouse events. I know I can put in a layer which has Background=Transparent, but that then gobbles up all of the mouse events. What I want is to see the mousemove events, reposition my object appropriately, and then let the mousemove events fall through to layers below.


  • adragton

    Hi Damien, drop me a line on alexpc65@hotmail.com if you wish.
  • Drag & Drop Operations