StandardDataFormats.Bitmap StandardDataFormats.Bitmap StandardDataFormats.Bitmap StandardDataFormats.Bitmap StandardDataFormats.Bitmap Property

Definition

A read-only property that returns the format ID string value corresponding to the Bitmap format.

public : static Platform::String Bitmap { get; }
static winrt::hstring Bitmap();
public static string Bitmap { get; }
Public Shared ReadOnly Property Bitmap As string
var string = Windows.ApplicationModel.DataTransfer.StandardDataFormats.bitmap;

Property Value

string string string

The format ID string value corresponding to the Bitmap format.

Examples

This example demonstrates the use of the Bitmap property. To use the code in this example, add an event listener to your app to handle the activated event. Then put this code in the function that this event listener calls.

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();
}
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);
    });
}