DataPackagePropertySet.Thumbnail DataPackagePropertySet.Thumbnail DataPackagePropertySet.Thumbnail DataPackagePropertySet.Thumbnail DataPackagePropertySet.Thumbnail Property


Gets or sets a thumbnail image for the DataPackage.

public : IRandomAccessStreamReference Thumbnail { get; set; }
IRandomAccessStreamReference Thumbnail();

void Thumbnail(IRandomAccessStreamReference thumbnail);
public IRandomAccessStreamReference Thumbnail { get; set; }
Public ReadWrite Property Thumbnail As IRandomAccessStreamReference
var iRandomAccessStreamReference = dataPackagePropertySet.thumbnail;
dataPackagePropertySet.thumbnail = iRandomAccessStreamReference;

Property Value


This example shows how you can add a thumbnail image to a DataPackage when sharing an image with a target app.

void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
    DataRequestDeferral deferral = e.Request.GetDeferral();
    e.Request.Data.Properties.Title = "Hello World!";
    e.Request.Data.Properties.Description = "This example shows how to share files and images.";
    if (this.dataPackageThumbnail != null)
        e.Request.Data.Properties.Thumbnail = this.dataPackageThumbnail;
function registerForShare() {
    var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();
    dataTransferManager.addEventListener("datarequested", shareImageHandler);

function shareImageHandler(e) {
    var request = e.request; = "Share Image Example"; = "A demonstration that shows how to share an image.";
    var deferral = request.getDeferral();
    Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\smalllogo.png").then(function (thumbnailFile) { = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(thumbnailFile);
        return Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\logo.png");
    }).done(function (imageFile) {;
    }, function (err) {


We recommend that any time you create a DataPackage that contains images, you also assign a thumbnail image. Doing so gives target apps the opportunity to display a visual representation of the images being shared to the user while the share operation completes.

The minimum recommended size is 80x80. The maximum size is 240x160. These sizes are in device-independent pixels, so if the system plateau setting is other than 1.0, appropriate multiplier should be used. For example, minimum recommended size for 1.4 plateau would be 801.4x801.4=112x112 physical pixels. If you're writing a target app, remember that while we recommend a minimum and maximum size, there is no enforcement of these sizes. Your app should have code to handle thumbnails that are an unexpected sizeā€”such as to scale them up or down as needed. Take care, however, not to alter the aspect ratio of the image.

You can use any data format (JPG, GIF, and so on) for a thumbnail. You also have the option of loading the thumbnail from the disk, or creating it on the fly.