Drag and drop in Win UI

123244 60 Reputation points
2024-11-05T15:20:14.6+00:00

Hi, I'm doing drag and drop in Win UI application, but I have a problem. In drag and drop there is only Data.SetStorageItems method. It accepts an IStorageItem with which I have no access to hidden files and shortcuts (only using file picker, but in my case it is not an option). Are there any alternative ways to access such files, or to perform a drag and drop operation?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,776 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
798 questions
{count} votes

1 answer

Sort by: Most helpful
  1. César Manuel Cuervo Orizondo 0 Reputation points
    2024-11-10T22:58:37.35+00:00

    There is no straightforward method in WinUI’s drag-and-drop system to directly handle hidden files or shortcuts. However, you can work around this limitation by accessing the files programmatically using the System.IO API (for hidden files), resolving shortcuts manually (via Shell32), or handling the drag-and-drop data with file paths.

    For more flexible drag-and-drop scenarios involving hidden files and shortcuts, manually managing the drag-and-drop data (file paths) and accessing those files directly is often the best approach.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.