,

Placing Text on the Clipboard

The static System.Windows.Clipboard class allows you to place text on the systemwide clipboard, or to detect whether any text exists on the clipboard.


Note

You cannot retrieve the clipboard text from a Windows Phone app, only set it. Calling the GetText method raises a SecurityException.


Clipboard contains the following three methods:

Image ContainsText()Queries the clipboard for the presence of text. Returns true if text is present; otherwise, false.

Image SetText(string text)Places text in the clipboard.

Image GetText()Raises a SecurityException on the Windows Phone platform.

Placing a Unicode string on the clipboard can be performed as shown:

Clipboard.SetText("foo");

The following example shows how to detect whether text is present on the clipboard:

bool clipBoardHasText = Clipboard.ContainsText();

If the ContainsText method returns true it indicates that the clipboard button will be visible when the SIP is displayed (see Figure 6.12).

Image

FIGURE 6.12 Text on the clipboard causes the SIP to display the clipboard button.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.248.211