Dela via


Sharing content (XAML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Sharing is how users connect the content of your app with the people they care about and the apps they use most. We've put together the following information to help you learn how to best use sharing in your app:

In this section

Topic Description

Quickstart: Sharing content

Successful apps make it easy for users to share what they are doing with their friends and family. Apps that make it easy for users to share content often see an increased awareness of the app, and that encourages users to use the app more often.

How to share text

Sharing text is one of the most basic, yet essential, methods for sharing content. In addition to plain-text messages, such as status updates, we recommend that your app support sharing text:

  • When you want the content to be available to a large number of target apps.
  • As a secondary source when sharing links or sharing HTML.

How to share a link

Links are another common data format that users want to share. The most common reason to share a link is when a user has specifically selected one; however, we also recommend that your app support sharing links:

  • When the content the user selects is also available online.
  • As a secondary source when sharing HTML.

Note  

Links can also be shared by using Tap and send. Tap and send is sharing through Near Field Communication (NFC).

 

How to share HTML

Sharing HTML content is different from other basic formats, such as text or a link. The main challenge is that the content a user selects might contain references to other elements. Apps that support sharing HTML need to consider how to handle these references, to ensure that users share the content they want.

How to share files

Users often want to share files with other people or apps. Using the sharing feature, your app can easily support tasks ranging from emailing a file to a colleague to sharing a set of pictures from a family vacation.

Files can also be shared by using Tap and send. Tap and send is sharing through Near Field Communication (NFC).

How to support pull operations

Most of the time, the app supplies the share data immediately from its DataRequested event handler. Sometimes, however, your app may need time to get the data ready for sharing. At those times, you can provide a list of supported formats, but delay preparing and providing the content until the target app requests it. Deferring to provide content until the target app requests it is called a pull operation (or delayed sharing).

How to make asynchronous calls in your DataRequested handler

Here, we'll show you how to produce data asynchronously in response to a DataRequested event.

 

These topics talk about how to share content with other apps. We call apps that perform this role source apps. If you want to receive shared content from other apps, see Receiving shared content.