Share via


Clipboard.GetContent Method

Definition

Gets the current content that is stored in the clipboard object.

public:
 static DataPackageView ^ GetContent();
 static DataPackageView GetContent();
public static DataPackageView GetContent();
function getContent()
Public Shared Function GetContent () As DataPackageView

Returns

Contains the content of the Clipboard, or an empty DataPackageView if the Clipboard is empty or unavailable.

Examples

DataPackageView dataPackageView = Clipboard.GetContent();
if (dataPackageView.Contains(StandardDataFormats.Text))
{
    String text = await dataPackageView.GetTextAsync();

    // To output the text from this example, you need a TextBlock control
    // with a name of "TextOutput".
    TextOutput.Text = "Clipboard now contains: " + text;
}

Remarks

If the GetContent call is successful, you can use the DataPackageView it returns to get information such as the file types it supports and any properties that the source app assigned through the DataPackagePropertySet class.

Applies to