michielpost.nl

Silverlight Multi File Uploader with Drag and Drop

11-12-2009

Silverlight 4 beta is out and it includes a very nice feature. It's now possible to drag and drop files from outside the browser to a Silverlight application.

We set AllowDrop="True" on the main Layout grid. After that, we define the Drop event:
Drop="LayoutRoot_Drop"

This event gives access to the files that were dropped on the Silverlight 4 application:

private void LayoutRoot_Drop(object sender, DragEventArgs e)
{
            FileInfo[] files = ( FileInfo[])e.Data.GetData(System.Windows.DataFormats.FileDrop);    

        foreach (FileInfo file in files)
        {
             //Add files to the Upload Queue
         }
}
 
S
This functionality will be included in the 4.0 release of the Silverlight Multi File Uploader.
Want to play with it already? Check out the latest checkin on Codeplex. It includes the drag and drop functionality for the Silverlight Multi File Uploader
 
Screenshot:

Comments


Manoj 21-12-2009
Hi, Is there any workaround to do the drag and drop of files in Silverlight 3?


Michiel 11-01-2010
No, this functionality is not possible in Silverlight 3, because Silverlight 3 does not support it. The support for drag and drop is added in Silverlight 4.


zck 25-01-2010
Excuse me. I want to resize images before upload with silverlight, but it seems that Silverlight 3 does not support it.who can tell me how can I do? Thanks


Bala 10-06-2010
First of all thanks for this wonderful control. I have issues with the drag and drop functionality in Mac(Safari/firefox). Is there a workaround for this?


RAM 18-06-2010
Download to Upload


New Comment

Name
E-mail (not published)
Comment
Enter the code shown: