-api-id | -api-type | -api-device-family-note |
---|---|---|
T:Windows.ApplicationModel.DataTransfer.DataTransferManager |
winrt class |
xbox |
Programmatically initiates an exchange of content with other apps.
The DataTransferManager class is a static class that you use to initiate sharing operations. To use the class, first call the GetForCurrentView method. This method returns the DataTransferManager object that is specific to the active window. Next, you need to add an event listener for the datarequested event to the object. This event is fired when a sharing operation starts— typically when the user taps the Share charm, although it is also fired if your app starts a share operation programmatically.
The DataTransferManager class includes a ShowShareUI method, which you can use to programmatically start a share operation.
The DataTransferManager class also has a TargetApplicationChosen event. Use this event when you want to capture what applications a user selects when sharing content from your app.
Note
This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).
This API is supported in native apps only.
Windows version | SDK version | Value added |
---|---|---|
1607 | 14393 | IsSupported |
1703 | 15063 | ShareProvidersRequested |
1709 | 16299 | ShowShareUI(ShareUIOptions) |
This example shows a typical way of using the DataTransferManager object.
[!code-jsDataTransferManager_1]