Share via


DataPackagePropertySet.Description 属性

定义

获取或设置描述 DataPackage 内容的文本。

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

void Description(winrt::hstring value);
public string Description { get; set; }
var string = dataPackagePropertySet.description;
dataPackagePropertySet.description = string;
Public Property Description 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 对象添加说明。 目标应用可以使用此说明来帮助用户确定他们正在共享的内容。

适用于