c# - Drag file from WPF App -


i find lot of samples describe how drag file wpf app. need export .txt or .csv file app when user try drag listbox item.

var filestream = file.create(@"c:\users\myuser\documents\test.txt"); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); //filestream.close(); dataobject data = new dataobject(dataformats.filedrop, filestream); dragdrop.dodragdrop(this, data, dragdropeffects.copy); //filestream.close(); 

but if release on desktop there isn't file copied. wrong?

the reason file drop not working not providing list of files paths requirement clipboard format. fix this...

var filename = @"c:\users\myuser\documents\test.txt" var filenames = new string[] { filename }; var filestream = file.create(filename); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); filestream.close();  dataobject data = new dataobject(dataformats.filedrop, filenames); dragdrop.dodragdrop(this, data, dragdropeffects.copy); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -