Share via


Clipboard.SetContent(DataPackage) Method

Definition

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

public:
 static void SetContent(DataPackage ^ content);
 static void SetContent(DataPackage const& content);
public static void SetContent(DataPackage content);
function setContent(content)
Public Shared Sub SetContent (content As DataPackage)

Parameters

content
DataPackage

Contains the content of the clipboard. If NULL, the clipboard is emptied.

Remarks

Use this method after creating and defining a DataPackage with the data you want to put on the clipboard. Call this method only when the application is in the foreground, or when a debugger is attached.

If the content cannot be set to the clipboard (for example, because the application is not in the foreground), the method throws an exception. Use the SetContentWithOptions method to set clipboard content without an exception.

The content is eligible for clipboard history and can be synced to other devices. To exclude the content from clipboard history and syncing, use the SetContentWithOptions method.

Applies to

See also