DataPackagePropertySet.Title 属性

定义

获取或设置显示为 DataPackage 对象内容的标题的文本。

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

属性值

String

Platform::String

winrt::hstring

显示为 DataPackage 对象内容的标题的文本。

示例

此示例演示如何在 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!");
}

注解

必须设置此属性。 如果没有它,任何涉及 DataPackage 的共享操作都将失败。

适用于