Projectreunion: Discussion: What do you want to see in a better drag & drop API for Windows?

Created on 11 Jun 2020  路  10Comments  路  Source: microsoft/ProjectReunion

Discussion: What do you want to see in a better drag & drop API for Windows?

In a similar vein to other discussion threads (Clipboard in #63), we at Windows are trying to understand how we can improve the drag & drop APIs in Windows as part of Project Reunion. As such, we would love _your_ feedback on drag & drop in Windows -

  • What have you liked about it, what have you disliked?
  • If you are implementing clipboard functionality in your app, why are you not implementing drag & drop? This especially becomes a relevant discussion as we move to a world of devices which are "touch-first" as opposed to "mouse & keyboard-first".

We are open to your ideas, constructive criticisms, comments, questions, concerns in this thread. We really want to hear them to make it easy for _you_ to build more powerful apps which delight your users!

Examples of bugs / feature requests relating to drag & drop you have raised on our partner XAML team's github which we are tracking internally:

https://github.com/microsoft/microsoft-ui-xaml/issues/2364
https://github.com/microsoft/microsoft-ui-xaml/issues/2421


High-level overview of the drag & drop API surface on Windows

There are a few ways to implement drag & drop in a Windows app today:

  1. If your app uses XAML/WinUI
    Detailed blog post: https://docs.microsoft.com/en-us/archive/msdn-magazine/2015/august/windows-10-modern-drag-and-drop-for-windows-universal-applications
    Samples: https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/XamlDragAndDrop

  2. If your app is a WPF: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/drag-and-drop-overview

  3. (For all UWP apps) Via the UWP API: https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.datatransfer.dragdrop.core?view=winrt-19041

  4. (For all classic Win32 apps) Via the OLE drag & drop API: https://docs.microsoft.com/en-us/cpp/mfc/drag-and-drop-ole?view=vs-2019

We understand that this is obviously really confusing. The most modern APIs are 1) and 3), the UWP ones and we expect these to be the foundation for Project Reunion drag & drop. But we want to do better - we want to know what your pain points have been at using any of them, and what you'd like to make things better for your users.


Please respond to this thread to let us know your ideas, and we'll break them off into separate issues/discussions as necessary.

area-Drag and Drop discussion

Most helpful comment

Obviously you already have this on your radar, but for me the most important thing is to make files writable by default, especially if dragged from File Explorer.

All 10 comments

Irrespective of platform framework, these are some of the things I would expect from a Drag and Drop experience

  • Custom visual for the thing whilst it is being dragged;
  • Changing the visual to reflect when a drag operation will be successful or will fail;
  • Enable whole window as drop target, as well as a UI element acting as a drop target;
  • Metadata attached to the dragged content, so apps can provide multiple experiences depending on what content it is receiving; (images, text or formatted content etc)
  • Enable drop of multiple items; (batch processing?)
  • Apps can declare what content it will accept for receiving;

Obviously you already have this on your radar, but for me the most important thing is to make files writable by default, especially if dragged from File Explorer.

Obviously you already have this on your radar, but for me the most important thing is to make files writable by default, especially if dragged from File Explorer.

I'll provide some additional historic links (you could simply search for "uwp drag and drop readonly":

Off topic: It feels frustrating to renew these kind of old feature requests. We had uservoice, we had another platform (which was introduced in a build 20xx?) where we could view the status of such feature requests. All got abandoned. Now we have to repost them on Feedbackhub? or Project Reunion. Still I'm hopeful that those kind of issues will get addressed.

Off topic: It feels frustrating to renew these kind of old feature requests. We had uservoice, we had another platform (which was introduced in a build 20xx?) where we could view the status of such feature requests. All got abandoned. Now we have to repost them on Feedbackhub? or Project Reunion. Still I'm hopeful that those kind of issues will get addressed.

I wish I could say anything better, but here is our best answer for now: We at Microsoft are sorry that we keep changing how we accept and request feedback from you and our other platform developers, and we're sorry that with each change we leave some old ideas and concerns behind even though they may still be live. We're trying to be better about this. (I have personally heard and participated in internal discussions regarding this.) We know you have no good reason to believe that, but even so we ask for your understanding as we figure out the best way we can talk to you.

Obviously you already have this on your radar, but for me the most important thing is to make files writable by default, especially if dragged from File Explorer.

@benstevens48 you might want to check out https://github.com/microsoft/microsoft-ui-xaml/issues/2421.

My main pain point with the drag/drop API is how hard it is to provide a proper drag image from a Windows Forms app, since the default WinForms IDataObject cannot properly communicate with the internal Windows drop subsystem. This means I will need to rewrite a lot of code to enable use of the SHDoDragDrop() function, which is the only flat-Win32 drag/drop code I know of that supports drag images. The "modern drag and drop" API (Windows.UI.Xaml.DragUI et al) is almost perfect; all I would want from it is to be able to write data (and drag images) to it even if I鈥檓 not using WinUI 3 for my GUI stack. Thanks!

Thank you everyone for the informative feedback so far!

My main pain point with the drag/drop API is how hard it is to provide a proper drag image from a Windows Forms app, since the default WinForms IDataObject cannot properly communicate with the internal Windows drop subsystem. This means I will need to rewrite a lot of code to enable use of the SHDoDragDrop() function, which is the only flat-Win32 drag/drop code I know of that supports drag images. The "modern drag and drop" API (Windows.UI.Xaml.DragUI et al) is almost perfect; all I would want from it is to be able to write data (and drag images) to it even if I鈥檓 not using WinUI 3 for my GUI stack. Thanks!

This is actually one of the exact scenarios we want to be enable in Reunion. Windows Forms uses the older drag & drop mechanism involving IDataObject which is harder to work with. In Reunion, we hope to provide an API for _any_ app with an HWND or CoreWindow/AppWindow to call into the "modern drag & drop" implementation, how Windows.UI.Xaml et al do it, without an assumption on the GUI framework.

Obviously you already have this on your radar, but for me the most important thing is to make files writable by default, especially if dragged from File Explorer.

Thank you for highlighting this issue. We understand this is a request from a lot of developers; we will do our best to appropriately prioritize it for Reunion as well an update to the API in the Windows SDK.

Irrespective of platform framework, these are some of the things I would expect from a Drag and Drop experience

  • Custom visual for the thing whilst it is being dragged;
  • Changing the visual to reflect when a drag operation will be successful or will fail;
  • Enable whole window as drop target, as well as a UI element acting as a drop target;
  • Metadata attached to the dragged content, so apps can provide multiple experiences depending on what content it is receiving; (images, text or formatted content etc)
  • Enable drop of multiple items; (batch processing?)
  • Apps can declare what content it will accept for receiving;

This a great list of the features of a delightful drag & drop experience, thank you for sharing that. FWIW, a lot of these are already provided by Windows' modern drag & drop experience as mentioned above. We hope to expand modern drag & drop to be accessible by all Windows apps via Reunion; and make it easier to use.

@Ram-G : what's the next step for your team with this (e.g., project proposal?)

@stevewri We have a draft API spec out for review here #141!

I just found that in Win32 apps you can't drag files from non-elevated app to elevated app.
I believe it should be possible for any kinds of app, but for security it could be readonly of even path-only. "Anything" would be better than current "nothing".

https://social.technet.microsoft.com/Forums/windows/en-US/cba0e9b1-25f8-40e5-a888-1435d604f68d/quotrun-as-administratorquot-prevents-drag-and-drop-working

Was this page helpful?
0 / 5 - 0 ratings