Silverlight 4 introduced a new API for working with text via the clipboard. Currently Silverlight's clipboard API is limited only to text, but it is still a great way for your application to interact with not only its host page, but the entire host OS. Working with the clipboard is all about using the new Clipboard
static class. The Clipboard
class exposes three methods for working with text as follows:
Setting and getting text from the clipboard is as trivial as it gets. To get data from the clipboard, we will use the following line of code:
string textFromClipboard = Clipboard.GetText();
To set the clipboard's text, we will use the following line of code:
Clipboard.SetText("Some sample text.");
When trying to use the Clipboard
class in a...