Gets or sets a thumbnail image for the DataPackage.
Syntax
var thumbnail = dataPackagePropertySet.thumbnail;
dataPackagePropertySet.thumbnail = thumbnail;
Property value
Type: IRandomAccessStreamReference
The IRandomAccessStreamReference that represents the thumbnail image.
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 80*1.4x80*1.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.
Windows Phone 8
This API is not implemented and will throw an exception if called.
Examples
This example shows how you can add a thumbnail image to a DataPackage when sharing an image with a target app.
function registerForShare() { var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView(); dataTransferManager.addEventListener("datarequested", shareImageHandler); } function shareImageHandler(e) { var request = e.request; request.data.properties.title = "Share Image Example"; request.data.properties.description = "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) { request.data.properties.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(thumbnailFile); return Windows.ApplicationModel.Package.current.installedLocation.getFileAsync("images\\logo.png"); }).done(function (imageFile) { request.data.setBitmap(Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile)); deferral.complete(); }, function (err) { request.failWithDisplayText(err); }); }
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013