Path element as Drop target

Jul 21, 2009 at 12:04 PM

Hi Kevin,
    Thanks for that awesome piece of code :) I have a canvas with predefined set of paths. Each of them I want to make as a Drop Targets. I have stackpanel where there are list of dynamically generated controls [each one has a ellipse and a textblock which will have text given at runtime] which are Drag Sources. For visualization lets assume that there is a map of states defined in path elements' and there is a list of controls on the right side with these drop. There is no restriction on drags or drops. All targets accept all sources. On dropping a target, source will get a new background color with the drag target in center. And after a submit happens, we can say the match is valid or not.
    How can I map the paths as drop targets and controls as drag sources in code?
    Thanks and regards,

Jul 24, 2009 at 3:25 PM

Hi Pooran,


making sure all the drop targets are ok for any drag source should be easy: set the "AllowAnyDropTarget"-property to true on your DragSource (you'll need the latest source code drop for this).  As far as mapping a path as a drop target, I'm afraid that scenario is not supported at the moment... :(  A droptarget has to have a dragsource as content, and a dragsource's template always has a border (for bounding box) and a grid which is used for containing content.  So, you can add a path as content to the dragsource, but it will always be surrounded by a rectangle-object...  You might be able to achieve what you want, but you'll have to change the sourcecode & template of the droptarget/dragsource for that I'm afraid...


Kind regards,