Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 22-Oct-18 0:26am
v3
Comments
[no name] 14-May-18 23:21pm    
Maybe WPF doesn't "recognize" the "Contact Card".

Word docs, Excel sheets, HTML docs are practically "universal"; not some "Contact Card".

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?

EDIT1: accidently posted this as solution - it was intended as comment...
 
Share this answer
 
v2
Comments
Kim Togo 29-Nov-12 3:10am    
In my WPF I have set "AllowDrop" to true, and have hookup all events on "DragEnter", "DragOver", "DragLeave" and "Drop"

In my "DragOver" event, I have set e.Effects = DragDropEffects.Copy and e.Handled = true.
But still no "DragEnter", "DragOver" events is triggered, WHEN I do a Drag & Drop from Microsoft Lync.

If I do a Drag & Drop from Internet Explorer, it works as expected.
earloc 29-Nov-12 3:25am    
Ok, that sure seems weird. But the complete Drag&Drop behavior is a chapter of it's own since the beginning...WPF, sadly, does nothing to make this event-hazzle a bit more programmer friendlier (at least not OOTB).
I would check if the DragDropEffect your are setting is supported by the Lync-Drag operation (e.g. by examining the AllowedEffects-property of the DragEventArgs).

Also try to hookup to the GiveFeedback-event.

Sorry i can't help more on this issue.
Kim Togo 29-Nov-12 4:03am    
Hi Earloc
I very much appreciate your help.

And about "I would check if the DragDropEffect your are setting is supported by the Lync-Drag operation (e.g. by examining the AllowedEffects-property of the DragEventArgs)."

My problem is, that no Drag events are generate in my WPF application. But in WinForm it works.
The solution to this problems was an update to Microsoft Lync 2010 from Microsoft.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900