DataPackagePropertySet.Title DataPackagePropertySet.Title DataPackagePropertySet.Title DataPackagePropertySet.Title DataPackagePropertySet.Title Property

Definition

Gets or sets the text that displays as a title for the contents of the DataPackage object.

public : Platform::String Title { get; set; }
winrt::hstring Title();

void Title(winrt::hstring title);
public string Title { get; set; }
Public ReadWrite Property Title As string
var string = dataPackagePropertySet.title;
dataPackagePropertySet.title = string;

Property Value

string string string

The text that displays as a title for the contents of the DataPackage object.

Examples

This example shows how you can set the title for the content in a DataPackage.

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

Remarks

Setting this property is mandatory. Without it, any share operations involving the DataPackage will fail.