I use DragDrop.DoDragDrop to copy files from my C# WPF application to Windows explorer. However, the actual copying of the files causes my WPF application to freeze until the copying is complete. This copy operation could last a few seconds to several minutes.
DataObject dragdata = new DataObject(DataFormats.FileDrop);
System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
//fill the StringCollection with filenames
dragdata.SetFileDropList(sc);
DragDrop.DoDragDrop(listviewitem, dragdata, DragDropEffects.Copy);
How can I call the DoDragDrop method without freezing/locking my application? I have not been able to make sense of the reported 'async' implementation of DataObject.