Windows.ApplicationModel.DataTransfer.DataTransferManager.GetForCurrentView

November 12, 2020 ยท View on GitHub

-description

Returns the DataTransferManager object associated with the current window.

-returns

The DataTransferManager object associated with the current window.

-remarks

Each window has a DataTransferManager object associated with it. When sharing content, you use the GetForCurrentView method to get the DataTransferManager object that is associated with the active window. After you have the appropriate DataTransferManager object, you can add an event listener to it to handle the DataRequested event, which the system fires when a share operation is initiated. Your app uses the DataRequest object returned with this event to set the data that the user wants to share with a target app.

-examples

This example calls the GetForCurrentView method to get the DataTransferManager object associated with the active window for the app.

[!code-csharpHowToShareTextBasic]

-see-also