DataPackage.SetText | setText method

0 out of 1 rated this helpful - Rate this topic

Sets the text that a DataPackage contains.

Syntax


dataPackage.setText(value);

Parameters

value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The text.

Remarks

This method sets the text value for StandardDataFormats.Text. It's the equivalent of calling dataPackage.setText(StandardDataFormats.Text).

Text is one of the data types that the DataPackage object supports directly. See the StandardDataFormats class for information on other supported data types.

Examples


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!");
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.ApplicationModel.DataTransfer
Windows::ApplicationModel::DataTransfer [C++]

Metadata

Windows.winmd

See also

DataPackage

 

 

Build date: 2/25/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.