Drag&Drop File Attribute is ReadOnly

牧云@^-^@ 提交于 2019-12-24 02:47:07

问题


I created an Attached Property which registers the drag and drop events and requests the operations: move, link, copy.

        UIElement dragablecontrol = d as UIElement;
        if (dragablecontrol != null)
        {
            dragablecontrol.AllowDrop = true;
            dragablecontrol.DragEnter += Dragablecontrol_DragEnter;
            dragablecontrol.DragStarting += Dragablecontrol_DragStarting;//does not get fired
            dragablecontrol.DragOver += Dragablecontrol_DragOver; //e.AcceptedOperation got move, link, copy
            dragablecontrol.Drop += Dragablecontrol_Drop; //e.DataView.RequestedOperation is set none
        }

Anyway the starting drag event is not fired and my RequestedOperation are ignored because e.Data is null in drag enter.

Therefore (I guess) the event argument parameter e.DataView.RequestedOperation is set to None in the drop event. The file attributes I get with var filesAndFolders = await e.DataView.GetStorageItemsAsync(); are set to ReadOnly.

What can I do about that. I need to rename the dragged files. I created a demo project on GitHub.

来源:https://stackoverflow.com/questions/41846811/dragdrop-file-attribute-is-readonly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!