DataPackagePropertySetView.Thumbnail 属性

定义

获取 DataPackageView 的缩略图。

public:
 property RandomAccessStreamReference ^ Thumbnail { RandomAccessStreamReference ^ get(); };
RandomAccessStreamReference Thumbnail();
public RandomAccessStreamReference Thumbnail { get; }
var randomAccessStreamReference = dataPackagePropertySetView.thumbnail;
Public ReadOnly Property Thumbnail As RandomAccessStreamReference

属性值

表示缩略图的 IRandomAccessStreamReference

示例

此示例演示如何从 DataPackageView 获取缩略图。

if (shareOperation.data.properties.thumbnail) {
    shareOperation.data.properties.thumbnail.openReadAsync().then(function (thumbnailStream) {
        var thumbnailBlob = MSApp.createBlobFromRandomAccessStream(thumbnailStream.contentType, thumbnailStream);
        var thumbnailUrl = URL.createObjectURL(thumbnailBlob, false);
        // To display the thumbnail, you need an element with id of "thumbnail"
        // in your HTML page.
        document.getElementById("thumbnail").src = thumbnailUrl;
    });
}

注解

建议每当获取包含图像的 DataPackageView 时,也检查缩略图。 这样,你的应用就可以在共享操作完成时向用户显示共享图像的可视表示形式。

适用于