Dragging and dropping from Silverlight to WPF

I am wondering if anyone was able to drag and drop some element (say an image with an ID) in silverlight and put it in a list in WPF.

If you have any, please help;)

Thanks, S

+2


a source to share


3 answers


Dragging and dropping into a Silverlight application from other surfaces outside of a Silverlight application is only available in Silverlight 4 and is limited by the file payload.



Hence, the only drag and drop functionality you can achieve between a WPF application and Silverlight is if you initiate a drag and drop operation in a WPF application and include a standard file list as part of the tab-bound data.

+1


a source


I agree with @AnthonyWJones. Silverlight doesn't have the System.Windows.DragDrop.DoDragDrop method that WPF does, so you can't initiate a "real" drag and drop. You can drag and drop controls in your application, but you cannot do what you ask.



0


a source


Anthony and Timores are correct in their answers, but I'll try to get creative with some ideas here:

  • If you can use the same backend services, maybe when the drag starts (MouseDown + MouseMove) you can send a chunk of XAML up to the service to store / cache the content and when the drag ends up by another application (MouseEnter + MouseUp over the target). you can call this service to pull the cached content
  • In Silverlight 4, you have access to your users' My folders on the local file system. You may be able to use the temp file and start / drag drag events described above to pass you a piece of XAML from one application to another. See http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#localfiles
  • If you want to drag and drop text, you can use the clipboard. So when dragging starts, copy the text to the clipboard. When you're done dragging in another app, read from the clipboard and add the content to the target folder
0


a source







All Articles