haithambradai / gong-wpf-dragdrop

Automatically exported from code.google.com/p/gong-wpf-dragdrop
0 stars 0 forks source link

Design question #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Grokys. Looks like its getting busy on the drag and drop front!

Anyway I've been playing around on my branch of the code. One thing that 
I've needed to change is the events from the 'Preview' versions to the 
standard event version. i.e. Switching the events from tunnelling to 
bubbling.

This change means that I can put nest controls that all support drag and 
drop. (I think this is also the issue that FreakOnALuis is getting when 
using a slider on a draggable element.)

So my question is what was the reason for picking the tunnelling event? So 
far I haven't found any issues with making this change but just because I 
haven't found anyway doesn't mean there aren't any. Am I missing something?

Thanks,

Jon

Original issue reported on code.google.com by mitchell...@gmail.com on 5 May 2010 at 9:27

GoogleCodeExporter commented 9 years ago
Hi Jon,

I mainly used them because all of the examples I was working from used them! 
However, the 
tunnelling events get called before the bubbling events, so using the PreviewX 
events ensures 
that library code is called before any user code, which is usually the desired 
behaviour.

However, judging from yourself and FreakOnALuis' issues, it looks like this is 
not the correct 
behaviour for this library. So you're welcome to try changing it around on your 
branch: let me 
know how it works out for you.

(You may also want to merge recent changes from trunk into your branch, btw)

Original comment by gro...@gmail.com on 6 May 2010 at 9:23

GoogleCodeExporter commented 9 years ago
Out of interest: why have you found the need to move to bubbling events?

Original comment by gro...@gmail.com on 6 May 2010 at 9:24

GoogleCodeExporter commented 9 years ago
There are two reason. 

Firstly, I wanted to support the drag effect adorners on my whole application. 
To do this I 
implemented the IDropTarget interface on the main forms ViewModel and set the 
drag effect to 
None. This works great until you try and drop something on a control that 
should support 
dropping. Because the tunnelling event starts with the top of the visual tree 
the main form 
handles the drop and therefore you can't drop anything.

Secondly, I've got a control that I need to support drag and drop which I want 
to put in a 
list item which supports the drag reordering. It might sound a little weird but 
it does make 
sense in the context of application... honest!

The only issue I have found, which I'm not sure is because of the events used, 
is that I've 
got a text box on a list item and when I try to select the text by doing a drag 
selection the 
list item starts to be dragged. Not too sure why its happening, but I can live 
with it for the 
moment.

Original comment by mitchell...@gmail.com on 6 May 2010 at 9:59