StandardDataFormats.Text StandardDataFormats.Text StandardDataFormats.Text StandardDataFormats.Text StandardDataFormats.Text Property

Definition

A read-only property that returns the format ID string value corresponding to the Text format.

public : static Platform::String Text { get; }
static winrt::hstring Text();
public static string Text { get; }
Public Shared ReadOnly Property Text As string
var string = Windows.ApplicationModel.DataTransfer.StandardDataFormats.text;

Property Value

string string string

The format ID string value corresponding to the Text format.

Examples

This example demonstrates the use of the Text property. To use the code in this example, add an event listener to your app to handle the activated event. Then put this code in the function that this event listener calls.

//To see this code in action, add a call to ShareSourceLoad to your constructor or other
//initializing function.
private void ShareSourceLoad()
{
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);
}

private void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share Text Example";
    request.Data.Properties.Description = "An example of how to share text.";
    request.Data.SetText("Hello World!");
}
function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareTextHandler);
}

function shareTextHandler(e) {
    var request = e.request;
    request.data.properties.title = "Share Text Example";
    request.data.properties.description = "A demonstration that shows how to share.";
    request.data.setText("Hello World!");
}