<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx</link><description>The last time I looked at Drag and Drop was with Silverlight version 1 and now seemed like a good time to see how one might accomplish this seemingly straight forward task with managed code. The experience was interesting. Once I had it working, it was</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#319290</link><pubDate>Thu, 12 Nov 2009 19:26:09 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:319290</guid><dc:creator>dr d b karron</dc:creator><description>&lt;p&gt;what about &amp;lt;/Thumb ... &amp;gt;&lt;/p&gt;
&lt;p&gt;or am i being &amp;lt;/Dumb ...???&amp;gt;&lt;/p&gt;
&lt;p&gt;dr K&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=319290" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#281391</link><pubDate>Thu, 03 Sep 2009 19:26:39 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:281391</guid><dc:creator>suedama1756</dc:creator><description>&lt;p&gt;Thought you guys might be interested in this, just open source a &amp;quot;almost&amp;quot; WPF compatible drag drop framework for Silverlight &lt;a rel="nofollow" target="_new" href="http://blogs.imeta.co.uk/jyoung/archive/2009/07/21/726.aspx"&gt;blogs.imeta.co.uk/.../726.aspx&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=281391" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#169607</link><pubDate>Tue, 03 Feb 2009 16:38:44 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:169607</guid><dc:creator>ABL</dc:creator><description>&lt;p&gt;The scrumwall application at &lt;a rel="nofollow" target="_new" href="http://www.scrumwall.com/scrumwall.aspx"&gt;www.scrumwall.com/scrumwall.aspx&lt;/a&gt; has a good amount of drag and drop. Looks cool!&lt;/p&gt;
&lt;p&gt;Requires registering for the demo though.&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=169607" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#162112</link><pubDate>Sat, 17 Jan 2009 16:29:52 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:162112</guid><dc:creator>IanBlackburn</dc:creator><description>&lt;p&gt;The url to my blog entry above seems to have been comprehensively mangled some how, so here is a tinyurl instead:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://tinyurl.com/8zt98x"&gt;http://tinyurl.com/8zt98x&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=162112" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#161862</link><pubDate>Fri, 16 Jan 2009 23:35:05 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:161862</guid><dc:creator>noamarbel</dc:creator><description>&lt;p&gt;Of course, its the order that events get fired. The squere gets the event first (as it was registered last).&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=161862" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#161280</link><pubDate>Thu, 15 Jan 2009 21:48:13 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:161280</guid><dc:creator>Boot2TheHead</dc:creator><description>&lt;p&gt;Weird, that snapover bug only happens when the circle goes over the square but not vice versa.&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=161280" width="1" height="1"&gt;</description></item><item><title>Drag &amp;#038; Drop mit Managed Code at Programming with Silverlight, WPF &amp;amp; .NET</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160972</link><pubDate>Thu, 15 Jan 2009 09:34:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160972</guid><dc:creator>Drag &amp; Drop mit Managed Code at Programming with Silverlight, WPF &amp; .NET</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Drag &amp;amp;#038; Drop mit Managed Code at Programming with Silverlight, WPF &amp;amp;amp; .NET&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160972" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160676</link><pubDate>Wed, 14 Jan 2009 20:53:27 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160676</guid><dc:creator>Boot2TheHead</dc:creator><description>&lt;p&gt;I reproduced the snapover bug that thebirdbath found. I also managed to get the circle to stay 50% opaque (not sure how) and move the objects off the canvas. So it'll need some work but it's a helpful example. &lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160676" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160614</link><pubDate>Wed, 14 Jan 2009 18:48:47 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160614</guid><dc:creator>thebirdbath</dc:creator><description>&lt;p&gt;Found a bug.&lt;/p&gt;
&lt;p&gt;Grab the circle and then roll over to the square. &amp;nbsp;It will automatically grab the square and then fade the circle out a bit in opacity.....keep doing it and the circle will disappear entirely. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'm a blend/xaml designer so I can't give you any pointers on how to fix that, all I can help you with is making a much prettier square and circle. :)&lt;/p&gt;
&lt;p&gt;-zac&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160614" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160586</link><pubDate>Wed, 14 Jan 2009 17:42:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160586</guid><dc:creator>bobdupuy</dc:creator><description>&lt;p&gt;Setting the event handlers (mouse down, move, up) directly on the graphic objects is very easy to implement, as the hit testing is done by the framework.&lt;/p&gt;
&lt;p&gt;But it has a drawback: Sometimes, you need to do an action (drag and drop for example) when the mouse is close to the object, but still not inside it. For example, try to drag and drop a line that's 1 pixel wide...You probably want to add some extra space around the line to make interaction easier...&lt;/p&gt;
&lt;p&gt;This is possible when using the FindElementsInHostCoordinates method that takes a rectangle as parameter.&lt;/p&gt;
&lt;p&gt;Robert.&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160586" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160524</link><pubDate>Wed, 14 Jan 2009 15:24:22 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160524</guid><dc:creator>jesseliberty</dc:creator><description>&lt;p&gt;That sounds way too &amp;nbsp;defensive to my ears. Time for me to put together a FAQ about (a) how I approach this blog and (b) where to get more info and advanced coverage. Steve and Ian, thanks for the pointers on more advanced coverage.&lt;/p&gt;
&lt;p&gt;-j&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160524" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160494</link><pubDate>Wed, 14 Jan 2009 14:30:29 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160494</guid><dc:creator>jesseliberty</dc:creator><description>&lt;p&gt;Responding to comments: &amp;nbsp;It is always a balancing act as to how much to include in a blog entry. &amp;nbsp;I agree that a working model would have been good; I'll add that now. As for source, I did include the complete source, so I'm not sure why adding downloadable source would be helpful; I'm willing but in this case you can copy and paste.&lt;/p&gt;
&lt;p&gt;Steve, I like what you've done, but the goal here was just to show the fundamentals. Yours is very nice, but not quite as straightforward (imho). &lt;/p&gt;
&lt;p&gt;In any case, I'll update right now with a working version in an iframe.&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160494" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160172</link><pubDate>Tue, 13 Jan 2009 21:05:45 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160172</guid><dc:creator>Steve Strong</dc:creator><description>&lt;p&gt;I have done a lot of drag and drop in silverlight, &amp;nbsp;I have found the a better technique is to move the Mouse down and Mouse UP events from the actual objects, and place these events on the canvas, &amp;nbsp;Then use the visual tree to method do the hit test...&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Point oPoint = e.GetPosition(null);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;KnowledgeShape oFound = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (UIElement oElement in VisualTreeHelper.FindElementsInHostCoordinates(oPoint, this))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;KnowledgeShape oShape = oElement as KnowledgeShape;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (SelectStatus(oShape) == SelectionStatus.OnShape)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oFound = oShape;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else if ( oFound == null &amp;amp;&amp;amp; SelectStatus(oShape) == SelectionStatus.OnPage)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oFound = oShape;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160172" width="1" height="1"&gt;</description></item><item><title>re: Drag and Drop with Managed Code</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160142</link><pubDate>Tue, 13 Jan 2009 20:01:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160142</guid><dc:creator>IanBlackburn</dc:creator><description>&lt;p&gt;Hi Jesse,&lt;/p&gt;
&lt;p&gt;This is a nice example, but is limited in that it requires the use of a Canvas.&lt;/p&gt;
&lt;p&gt;I put together an example over on my Silverlight for Buiness blog (&lt;a rel="nofollow" target="_new" href="http://silverlightforbusiness.net"&gt;silverlightforbusiness.net&lt;/a&gt;) that shows how to perform drag and drop over any layout and also how to do a basic hit test:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blackburnian.spaces.live.com/blog/cns"&gt;blackburnian.spaces.live.com/.../cns&lt;/a&gt;!FB8B852EF1AB0B35!1759.entry &lt;/p&gt;
&lt;p&gt;Hope someone finds it useful!&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Ian&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160142" width="1" height="1"&gt;</description></item><item><title>Silverlight Cream for January 13, 2009 -- #484</title><link>http://blogs.silverlight.net/blogs/jesseliberty/archive/2009/01/13/drag-and-drop-with-managed-code.aspx#160140</link><pubDate>Tue, 13 Jan 2009 19:58:03 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:160140</guid><dc:creator>Community Blogs</dc:creator><description>&lt;p&gt;\ In this issue: Boyan Mihaylov, Thiago Felix, Bart Czernicki, Daomon Payne, Nigel Sampson, Jeff Weber&lt;/p&gt;
&lt;img src="http://blogs.silverlight.net/aggbug.aspx?PostID=160140" width="1" height="1"&gt;</description></item></channel></rss>