但是如果我打电话
DataTransferManager.ShowShareUI();
我只有两个选择。但在照片应用程序中,当我分享照片时,我会看到它的所有兼容应用程序,例如 Instagram。但我的应用程序只有两个。
最佳答案
看起来您的代码仅共享实际的位图:
req.data.SetBitmap(rasr)
在您安装的应用程序中,只有 Mail 和 OneNote 知道如何处理位图。这是相当常见的,许多共享目标都会接受 bitmap file但不是位图本身。请参阅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();
}
关于c# - 共享图像仅显示两个选项,Mail 和 Onenote,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41905429/