Hey guys,
I'll like to share multiple content types (Bitmap and StorageItems) using the DataTransferManager (see code below). Unfortunately, only the last attached event handler will be called. Is there a way to share multiple content types, or is that not supported?
If not, is there a reason for that?
Thanks, Jan.
private void RegisterForShare()
{
DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested += ShareImageListHandler;
dataTransferManager.DataRequested += ShareImageHandler;
}
private async void ShareImageHandler(DataTransferManager sender,
DataRequestedEventArgs e)
{
DataRequest request = e.Request;
request.Data.Properties.Title = "Current Image";
request.Data.Properties.Description = "Shares the current focused image.";
DataRequestDeferral deferral = request.GetDeferral();
try
{
// request.Data.SetBitmap
}
finally
{
deferral.Complete();
}
}
private async void ShareImageListHandler(DataTransferManager sender,
DataRequestedEventArgs e)
{
DataRequest request = e.Request;
request.Data.Properties.Title = "All images";
request.Data.Properties.Description = "Shares all images from the current list.";
DataRequestDeferral deferral = request.GetDeferral();
try
{
// request.Data.SetStorageItems
}
finally
{
deferral.Complete();
}
}