Jaa


DataPackagePropertySet.Thumbnail Property

Definition

Gets or sets a thumbnail image for the DataPackage.

public:
 property IRandomAccessStreamReference ^ Thumbnail { IRandomAccessStreamReference ^ get(); void set(IRandomAccessStreamReference ^ value); };
IRandomAccessStreamReference Thumbnail();

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

Property Value

The IRandomAccessStreamReference that represents the thumbnail image.

Examples

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;
    }
    e.Request.Data.SetBitmap(imageStreamRef);
    deferral.Complete();
}

Remarks

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.

Applies to