Drag and Drop image from browser to WPF Application

前端 未结 1 1704
日久生厌
日久生厌 2021-02-04 13:45

I\'m trying to implement functionality in my WPF application to drag an image out of a browser and into a window in my WPF app.

The code works fine with Firefox and Win

相关标签:
1条回答
  • 2021-02-04 14:42

    You can use the FileGroupDescriptorW and FileContent formats to get your data.

    • FileGroupDescriptorW is an array of FileDescriptors' that describe your data (e.g.: name, size, modified-time, ...)
    • FileContent contains your file contents.

    If you don't care about the filename and just need the binary content you could use

    var filestream = (MemoryStream[])dataObject.GetData("FileContents");
    

    If you want a more in-dept-tutorial on how to use the FileGroupDescriptor(W) I can recommend this tutorial on codeproject.com. It talks about drag&drop from MS Outlook, but it uses the same IDataObject formats.

    0 讨论(0)
提交回复
热议问题