Possible Duplicate:
C# / WPF / .NET - Drag and drop to Desktop / Explorer
I've managed to drag files from the Desktop into my WPF application. Now I want to drag them back out.
This code does not work. Everything looks right (the cursor turns into a +) but the file is not copied.
listBoxItem.PreviewMouseLeftButtonDown += (o, e) =>
{
Console.WriteLine("drag leave");
// changing this line to: var data = "a string"; works for text dragging
var data = new DataObject(DataFormats.FileDrop, filePath);
// also tried DragDropEffects.Copy with no success
DragDrop.DoDragDrop(item, data, DragDropEffects.All);
};
Any ideas?
Very similar question here but I don't understand their answer: c# drag drop DataObject
Thanks,
Neal