Silverlight Multi File Uploader with Drag and Drop
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: