[UWP] Windows 10拖放问题 [英] [UWP]Windows 10 Drag&Drop problem
问题描述
Hello
我有Windows Universl App,可以修改文件。现在我尝试添加一个从其他应用程序删除文件的功能(这与Windows 10一起提供),但是我发现当我调用
时我得到的文件
I have Windows Universl App which allows to modify files. Now I trying to add an ability to Drop Files from other app(this comes with Windows 10), but I've found that files I get when I call
DataView.GetStorageItemsAsync
DataView.GetStorageItemsAsync
都是ReadOnly,我没有找到改变这种情况的方法。
are all ReadOnly and I didn't find the way to change this situation.
有没有办法获得带有"读写"访问权限的文件 来自Windows 10 UWP应用程序中的D& D?
Is there a way to get files with ReadWrite access from D&D in Windows 10 UWP app?
Anatol
推荐答案
Hi AnatolSe,
Hi AnatolSe,
请阅读粘贴帖子,特别是
发布指南:主题行标签 和
Windows 10 SDK和工具的已知问题
Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools
>> ;有没有办法获取带有"读写"权限的文件 来自Windows 10 UWP应用程序中的D& D?
是的,据我所知,从Drag and Drop访问的所有文件都是ReadOnly。此问题的一种解决方法是将文件复制到本地存储,之后您可以读取和写入此复制的文件:
Yes, as far as I know all those file which accessed from the Drag and Drop are ReadOnly. One workaround for this issue is to copy the file to your Local storage, after that you can Read and Write this copied file:
var files = await e.DataView.GetStorageItemsAsync();
foreach (var storageItem in files)
{
var file = storageItem as StorageFile;
if (file != null)
{
//copy file to LocalFolder
var newCopyFile = await file.CopyAsync(ApplicationData.Current.LocalFolder, file.Name, NameCollisionOption.ReplaceExisting);
......
最诚挚的问候,
Amy Peng
Best Regards,
Amy Peng
这篇关于[UWP] Windows 10拖放问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!