Dela via


DataPackagePropertySet.Title Property

Definition

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

public:
 property Platform::String ^ Title { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring Title();

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

Property Value

String

Platform::String

winrt::hstring

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

Remarks

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

Applies to