将控件拖到主窗口之外
将文件拖到应用程序比将文件从应用程序拖到 Windows 中的目录更常见。在我的 wpf 应用程序中,我有一个文件列表。例如,我希望用户能够将这些文件(文件是带有图像和标签的自定义用户控件)拖动到桌面。可以这样做吗?而且我想使用Windows的默认功能。也就是说,如果我将文件拖到新磁盘分区,那么我会希望复制该文件。如果该目录恰好与该文件位于同一分区上,我想移动该文件。
编辑
我发现了很多很棒的例子,例如这个。 以及 SvenG 在这个问题的评论部分提到的一个。
当我需要传输大文件时,这些示例都不起作用。在文件复制或移动完成之前,鼠标光标和应用程序不允许我进行交互。我尝试在一个单独的线程上破坏它,但我无法做到这一点。
It is more common to drag files to an application than to drag files from an application to directory in windows. In my wpf application I have a list of files. I will like to enable the user to drag those files (files are custom user control with an image and label) to the desktop for example. Is it possible to do that? Moreover I will like to use the default functionality of windows. That is if I drag the file to a new disk, partition then I will like the file to be copied. If the directory happens to be on the same partition as the file I will like to move that file.
Edit
I found lots of great examples such as this one. and the one that SvenG mentioned in the comments section of this question.
none of those examples work when I need to transfer large files. The mouse cursor and application does not let me interact until the copying or moving of the file is done. I tried ruining that on a separate thread and I have not been able to do so.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论