Jaa


DataTransferManager.ShowShareUI Method

Definition

Overloads

ShowShareUI()

Programmatically initiates the user interface for sharing content with another app.

This API is for Universal Windows Platform (UWP) apps. The alternative API to use for a desktop app is described in Display WinRT UI objects that depend on CoreWindow.

ShowShareUI(ShareUIOptions)

Programmatically initiates the user interface for sharing content with another app.

This API is for Universal Windows Platform (UWP) apps. The alternative API to use for a desktop app is described in Display WinRT UI objects that depend on CoreWindow.

ShowShareUI()

Programmatically initiates the user interface for sharing content with another app.

This API is for Universal Windows Platform (UWP) apps. The alternative API to use for a desktop app is described in Display WinRT UI objects that depend on CoreWindow.

public:
 static void ShowShareUI();
 static void ShowShareUI();
public static void ShowShareUI();
function showShareUI()
Public Shared Sub ShowShareUI ()

Examples

This example demonstrates how to call the ShowShareUI method to launch the Share user interface. Notice that this example only launches the interface— it does not add any content to share with another app.

function launchShare() {
    var shareButton = document.createElement("button");
    shareButton.setAttribute("id", "showShareButton");
    shareButton.innerText = "Click to share!";
    shareButton.addEventListener("click", function () {
        Windows.ApplicationModel.DataTransfer.DataTransferManager.showShareUI();
    });
    document.body.appendChild(shareButton);
}

Remarks

A DataPackage must have its Title set in order to be shared. Ensure Title is set before calling this method.

See also

Applies to

ShowShareUI(ShareUIOptions)

Programmatically initiates the user interface for sharing content with another app.

This API is for Universal Windows Platform (UWP) apps. The alternative API to use for a desktop app is described in Display WinRT UI objects that depend on CoreWindow.

public:
 static void ShowShareUI(ShareUIOptions ^ options);
/// [Windows.Foundation.Metadata.Overload("ShowShareUIWithOptions")]
 static void ShowShareUI(ShareUIOptions const& options);
[Windows.Foundation.Metadata.Overload("ShowShareUIWithOptions")]
public static void ShowShareUI(ShareUIOptions options);
function showShareUI(options)
Public Shared Sub ShowShareUI (options As ShareUIOptions)

Parameters

options
ShareUIOptions

The options.

Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Examples

Display WinRT UI objects that depend on CoreWindow

Remarks

We recommend that you provide the user a Share affordance only when there is something shareable in your app. The prominence of the affordance can vary based on the nature of the content. For example, if the user gets a high score in a game, you may wish to put a Share button next to the congratulatory message. A news app, on the other hand, may put a Share button in an AppBar.

A DataPackage must have its Title set in order to be shared. Ensure Title is set before calling this method.

Applies to