Windows 10 Sample: Clipboard
Use clipboard to copy and paste text in different formats, including plain text, and formatted text (HTML).
To copy, add text formats to a DataPackage, and then place DataPackage to Clipboard.
To paste, get DataPackageView from clipboard, and retrieve the content of the desired text format from it.
To handle local image files in the formatted text (such as the one below), use ResourceMap collection.
DataPackage class is also used to share or send content between applications.
See the Share SDK sample for more information.
Copy and Paste an image
The DataPackage can also hold a bitmap. Select image using
item picker, copy it to the clipboard, and then paste it back into the application.
Image can also be provided via delayed rendering, when source app doesn't want to supply data until
target app requests it.
Select Image and copy
Select image and copy using delayed rendering
Copy and paste Files
The DataPackage can also hold files. Select files using the picker,
copy them to the clipboard, and then paste the files. This will copy the files into this app's local state folder.
Other Clipboard Operations
Your application can register for clipboard update notifications to decide whether to enable Paste
operation. Updates occur any time user copies something onto clipboard, or when it's emptied.
If the "Register Clipboard Content Change" check box below is checked, a list of available formats
on the clipboard will be displayed automatically whenever a clipboard update notification is received.
You can also use the "Show Clipboard Formats" button to manually display the current content of the clipboard.
Ausführtung unter Other Clipboard operations:
Wenn man hier ein Screenshot macht oder ein Dokument in die Zwischenablage kopiert, dann kommt automatisch die Erkennung auch über einen background task
Projekt Clipboard unter GitHub
This sample demonstrates how an app can use clipboard commands, including copy, paste, cut, and move.
This sample uses classes from the Windows.ApplicationModel.DataTransfer namespace.
Some of the classes you might want to review in more detail include the Clipboard class, which accesses the Clipboard, and the DataPackage class, which you use to package the content before adding it to the Clipboard.
This sample covers the following:
How to copy and paste text
How to copy and paste an image
How to copy and paste files
How to get the formats on the Clipboard
How to detect changes to the Clipboard
Unter Visual Studio