拖拽丢弃事件,WPF与WinForm [英] Drag & Drop event, WPF vs WinForm

查看:99
本文介绍了拖拽丢弃事件,WPF与WinForm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Drag& amp;中遇到了这个奇怪的问题。丢弃事件,我无法弄清楚。



我正在尝试制作Drag&在我简单的WPF应用程序中删除工作。

如果我将联系人卡从Microsoft Lync 2010拖到我的WPF程序,那么我不被允许。



我的WPF应用程序中没有DragEnter,DragOver或Drop事件。

但是如果我做一个Drag&从Word,Internet Explorer或Google Chrome等应用程序中删除它可以正常工作。我得到DragEnter,DragOver和Drop事件。



有线部分现在来了。如果我在WinForm应用程序中执行相同操作,那么当我执行Drag&从Microsoft Lync中删除联系人卡片。



我觉得,我需要在我的WPF应用程序中设置一些东西,可能是一些低级调试?



- 在我的WPF和WinForm中我将AllowDrop设置为true

在DragOver事件中,我设置了e.Effects = DragDropEffects.Copy和e.Handled = true。

I got this weird problem in Drag & Drop events, that I cannot figure out.

I am trying to make Drag & Drop work in my plain simple WPF application.
If I Drag a Contact Card from Microsoft Lync 2010 to my WPF program, then I am not allowed to.

There is no "DragEnter", "DragOver" or "Drop" event in my WPF application.
But if I do a Drag & Drop from applications like Word, Internet Explorer or Google Chrome it works fine. I get "DragEnter", "DragOver" and "Drop" events.

The wired part come now. If I do the same in a WinForm application, it works as expected when I do a Drag & Drop of a Contact Card from Microsoft Lync.

I feel, I need to setup something up in my WPF application, perhaps some low level debugging ?

- In my WPF and WinForm I have set "AllowDrop" to true
In "DragOver" event, I have set e.Effects = DragDropEffects.Copy and e.Handled = true.

推荐答案

你尝试了什么?当你在你的应用程序中说没有DragEnter事件等时,你在哪里看看?



例如,一个窗口有诸如DragEnter之类的事件,DragLeave等,但如果AllowDrop设置为false,它们不会被引发。这是你的问题吗?



EDIT1:意外地将其作为解决方案发布 - 它的目的是作为评论......
what did you try? when you say "no DragEnter event, etc. in you application", where did you look at?

A Window, for instance, has events such as "DragEnter", "DragLeave", etc. but they won't get raised if "AllowDrop" is set to false. Is that your problem?

accidently posted this as solution - it was intended as comment...


解决方案此问题是Microsoft对Microsoft Lync 2010的更新。
The solution to this problems was an update to Microsoft Lync 2010 from Microsoft.


这篇关于拖拽丢弃事件,WPF与WinForm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆