Silverlight Intuitive Drag and Drop

Silverlight Beta 1 gave us the ability to set the ZIndex, but some investigation of how it actually works on a canvas is useful to get the result you might expect:


Things don't always work like you expect, and as in many other instances, forewarned is forearmed.

I included 3 canvases to show examples of the issues I worked through getting it to work the way I wanted.

Silverlight Web Articles I've tagged and My Silverlight Articles


  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Monday, May 28, 2007 2:04 PM
Print

Comments on this entry:

# re: Silverlight Intuitive Drag and Drop

Left by -drew- at 5/28/2007 5:48 PM
Gravatar
"I like the way this canvas works... you mouse-down on one of the rectangles and it drags up on top of the other two in what is a more 'intuitive' drag-and-drop operation than simply moving the rectangles around."

Hey, on your first canvas, is it supposed to immediately bring the selected color to the front? I thought you mentioned that's your goal when we were at work Friday.

It seems that the only way the color square is brought to the front is if I click, *then move* the mouse.

Maybe I'm running a prior version of Silverlight. I get so confused with (what seems to me as) all of the recent releases.

# re: Silverlight Intuitive Drag and Drop

Left by Dave at 5/28/2007 5:53 PM
Gravatar
Yeah... the only way to get it to move is to redraw and we have no Canvas redraw, so I was stuck with making it move over the top of the others on MouseMove rather than Click. The thought crossed my mind about drawing it all at run-time, but that seemed a lot of work to go through in the general case.

# re: Silverlight Intuitive Drag and Drop

Left by -drew- at 5/29/2007 8:47 PM
Gravatar
I'm a fool! You mentioned all that in your article. My apologies for reading faster than my eyes can communicate with my brain ;)

Blame it on youth. I'll subsequently blame it on Nintendo, than the Internet in general.

# re: Silverlight Intuitive Drag and Drop

Left by different drew at 6/12/2007 10:01 PM
Gravatar
dave -

GREAT example, incredibly helpful - as all your silverlight examples. the code for drag/drop didn't compile right away; had to add javascript:onMouseUp to the XAML file... but once in place worked well.

i added the ability to drag / drop videos and wrapped up the code in a project file, if it helps anyone else out:

SILVERLIGHT VIDEO DRAG / DROP:
http://www.orangedevelopment.com/blogs/db.html#silverlight_dragdrop_001

# re: Silverlight Intuitive Drag and Drop

Left by different drew at 6/13/2007 6:50 AM
Gravatar
well, thanks to dave's initiative, i encouraged my webhost to update their MIME type for XAML, and now i can add webhost4life.com to the list of "Silverlight-ready" hosting. (thanks dave for spearheading this movement AND for taking the time to develop so many great silverlight tutorials!)

as a result, here's dave's intuitive drag & drop w/ video:

SILVERLIGHT VIDEO DRAG & DROP EXAMPLE:
http://www.orangedevelopment.com/apps/silverlightdragdrop/testpage.html

# re: Silverlight Intuitive Drag and Drop

Left by Magallo at 10/24/2008 3:15 AM
Gravatar
This is not Drag & Drop.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910