Drag&Drop File Attribute is ReadOnly

2019-07-15 08:11发布

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.

0条回答
登录 后发表回答