简体   繁体   中英

Drag and Drop control for Silverlight

Recently I needed to add drag & drop functionality to a Silverlight application. Can anyone recommend a good drag & drop control?

Here is a link to the best one I have found so far: http://nickssoftwareblog.com/2008/10/07/silverlight-20-in-examples-part-drag-and-drop-inside-out/

The code is available as a download from the blog post, although you have to rename it to a .zip: http://nickssoftwareblog.files.wordpress.com/2008/10/genericdragdropzip.doc

I created a Drag/Drop controller that I think works really well. I have been using this technique for a while, and I have been very happy with it.

http://houseofbilz.com/archive/2009/02/10/drag-and-drop-with-silverlight.aspx

I recommend the Silverlight Toolkit for dragging and dropping elements within the same application.

It already has been updated for Silverlight 5.

You can try Blacklight Controls which have a really neat drag-dock panel control. Here's a link to a blog describing how it works.

I am guessing you have already found a solution by now. But here is a solution I wrote and am currently using which is very flexible and easy to use: http://sl4dragdrop.codeplex.com/

It works on SL5 very well, all you have to do is add dependency properties on the items or itemscontrol on which you want to enable dragging or dropping.

By default, that is enough. But if you want to customize parts of drag/drop, it gives you interfaces to implement that can control things like Element to drag, Which element to drag from, What image to show while dragging etc.

I have recently refined it a bit and will be posting an update soon after some more testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM