Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF C#4.0 Drag drop
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 28-Nov-12 21:22pm
Kim Togo26.1K
Edited 28-Nov-12 22:11pm
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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...
  Permalink  
v2
Comments
Kim Togo at 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 at 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 at 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.

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

  Print Answers RSS
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 29 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100