1

I have a WFP application with a tree where I can drag and drop objects around.

 DragDrop.DoDragDrop(dragSource, new DataObject(typeof(IFileObject), ((FilePresenter)dragSource.DataContext).FileObject), DragDropEffects.Move | DragDropEffects.Copy);

Each tree object also represents a file on my harddrive. I would like to be able to also drag that object from my WPF application to explorer (to create a copy) or maybe to Outlook to create an attachment.

I assume (probably wrongly) that it depends on the target what kind of DataObject I have to attach, but at the time of starting the drag I don't where the user will drop the DataObject.

I know that other applications can create different kind of drops. When I drag an e-mail in Outlook for example, i can move it to a different folder. Dragging it to the explorer will create a msg file. Dragging it to a text editor will insert the subject of the email as text.

How do I have to initialize the DragDrop.DoDragDrop(...) to drag&drop inside my application by using my internal objects and outside my application to provide a filename?

This is not a duplicate of Can we drop a file in windows explorer from WPF window? My question is how to support BOTH internal and external drag and drop (if possible at all).

Community
  • 1
  • 1
flayn
  • 5,272
  • 4
  • 48
  • 69
  • possible duplicate of [Can we drop a file in windows explorer from WPF window?](http://stackoverflow.com/questions/3165874/can-we-drop-a-file-in-windows-explorer-from-wpf-window) and http://stackoverflow.com/questions/5662509/drag-and-drop-files-into-wpf – netaholic Sep 04 '15 at 08:13
  • @netaholic: Please read my question again. The first possible duplicate does not aim at supporting drag&drop internally and externally. The second question is about how to drop into WPF, which is not what I asked about. – flayn Sep 04 '15 at 08:41

1 Answers1

1

You can find an answer in this Post: c# Drag and Drop from my custom app to notepad

To investigate the right format maybe it helps to drop some data from explorer to your application and try to build the data accordingly.

Community
  • 1
  • 1
blueprint
  • 198
  • 8
  • Thank you for pointing out the proper duplicate (the answer there solved my problem). I will close this question. – flayn Sep 04 '15 at 09:26