Noob
Noob

Reputation: 1049

WPF Clipboard with Multiple Formats

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. This 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?

Upvotes: 0

Views: 459

Answers (1)

Oliver Weichhold
Oliver Weichhold

Reputation: 10296

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.

Upvotes: 1

Related Questions