Drop and Show files in WPF
How to Drop an image from Client Computer to WPF app. For example dropping image file from a folder or desktop to WPF app and the dropped image should be saved and s开发者_C百科howed in that dropped window as just an image. I've searched here similar questions to my question and I couldn't find what I need.
Please help me!
Thank you in advance :)
In target element (or at the window level) set the AllowDrop property to true. Then provide the element or window the DragDrop event handler.
In the event handler you will be able to get the filepath with something like:
e.Data.GetData(DataFormats.FileDrop, true)
Now that you know the location of the file you can do what you like with it.
精彩评论