开发者

WPF Clipboard with Multiple Formats

开发者 https://www.devze.com 2023-03-20 12:55 出处:网络
I have a situation where I want to allow a user to copy a combination of text and images to the clipboard.I then want to access this in my WPF app so I\'ve been using System.Windows.Clipboard.T开发者_

I have a situation where I want to allow a user to copy a combination of text and images to the clipboard. I then want to access this in my WPF app so I've been using System.Windows.Clipboard. T开发者_开发百科his class has a method called GetDataObject() returning an IDataObject. Then on the IDataObject I can call GetData() passing in the format I require (image, text, etc.).

However, I want to be able to get everything that was copied in the correct order. So if I have an image embedded between two paragraphs of text GetData() can return me all the text or all images but won't tell me where in the text the images sit.

So, does anyone know how to access text and embedded images in the correct order from the clipboard within a WPF app?


You need to ask for a clipboard format that retains these contextual information. Such as text/html. Wether such a format is available highly depends on the application that is used to copy the data in the first place.

0

精彩评论

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

关注公众号