分享一张图片只显示两个选项,Mail 和 Onenote
Share an image shows only two option, Mail and Onenote
我想在本地分享一张图片,我正在这样检索它
但是如果我打电话给
DataTransferManager.ShowShareUI();
我只有两个选择。但是在照片应用程序中,当我分享照片时,我会看到所有兼容的应用程序,比如 Instagram。但是我的应用程序只有两个。
知道如何获得这样的所有选项吗?
您的代码似乎只共享了实际的位图:
req.data.SetBitmap(rasr)
在您安装的应用程序中,只有 Mail 和 OneNote 知道如何处理位图。这很常见,许多共享目标将接受 bitmap file but not a bitmap itself. See How to share files
// Because we are making async calls in the DataRequested event handler,
// we need to get the deferral first.
DataRequestDeferral deferral = req.GetDeferral();
// Make sure we always call Complete on the deferral.
try
{
StorageFile logoFile =
await Package.Current.InstalledLocation.GetFileAsync("Assets\beautiful_folder\and_a_beautiful_file.jpg");
List<IStorageItem> storageItems = new List<IStorageItem>();
storageItems.Add(logoFile);
req.Data.SetStorageItems(storageItems);
}
finally
{
deferral.Complete();
}
我想在本地分享一张图片,我正在这样检索它
但是如果我打电话给
DataTransferManager.ShowShareUI();
我只有两个选择。但是在照片应用程序中,当我分享照片时,我会看到所有兼容的应用程序,比如 Instagram。但是我的应用程序只有两个。
知道如何获得这样的所有选项吗?
您的代码似乎只共享了实际的位图:
req.data.SetBitmap(rasr)
在您安装的应用程序中,只有 Mail 和 OneNote 知道如何处理位图。这很常见,许多共享目标将接受 bitmap file but not a bitmap itself. See How to share files
// Because we are making async calls in the DataRequested event handler,
// we need to get the deferral first.
DataRequestDeferral deferral = req.GetDeferral();
// Make sure we always call Complete on the deferral.
try
{
StorageFile logoFile =
await Package.Current.InstalledLocation.GetFileAsync("Assets\beautiful_folder\and_a_beautiful_file.jpg");
List<IStorageItem> storageItems = new List<IStorageItem>();
storageItems.Add(logoFile);
req.Data.SetStorageItems(storageItems);
}
finally
{
deferral.Complete();
}