开发者

Drop and Show files in WPF

开发者 https://www.devze.com 2023-03-06 06:47 出处:网络
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 w

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消