In my application the user can drag and drop files from windows explorer onto a listbox in my application. This all works excellent however when dragging multiple files, depending which file the user clicks in windows explorer to begin dragging, the order the files passed will differ when calling:
e.Data.GetData(DataFormats.FileDrop)
How do I receive the files in the same order as they are displayed in windows explorer?
Thanks for your help!
If you shift-select a bunch of files from 0000 to 0010 and then drag them into an application (say video files and drag them into VLC). Explorer will feed the list not in the order you selected the items but from the item you left-click-n-dragged from.
Click on 0000 and they will show up in number order. Click on 0003 and they will show up from 0003 to 0010 and then 0001 and 0002
So the correct way to "drag n drop" is to always drag from the top.
The order you receive them is the order in which they were selected. I encountered this problem once before and as far as I was able to tell you cannot get them in Explorer's sort order.
Therefore your code should assume the user selected them in that order for a reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With