WPF Drag Drop in Outlook

Add-in Express™ Support Service
That's what is more important than anything else

WPF Drag Drop in Outlook
 
tao wen




Posts: 12
Joined: 2007-07-30
I have a problem with using Drag Drop on wpf windows opened from a add-in created by add-in express.

what I do is, show the window:
AddinStartupComplete += delegate
{
new Application().Run(new MainWindow());
};

do drag drop:
PreviewKeyUp += delegate
{
DragDrop.DoDragDrop(this, new DataObject("Hello"), DragDropEffects.All);
};
and try to respond to:
DragOver += delegate
{
MessageBox.Show("Called");
};

The data object have been set correctly, as the outlook can accept it. But our DragOver event will never be fired.
Posted 30 Jul, 2007 06:20:05 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Tao.

Do you return DragDropEffects.Move in the GiveFeedback event handler of the form?




P.S. We always do our best to answer your forum requests as soon as possible. However, we apply the rule "first in first out" with Premium Support Service subscribers taking priority. Please understand it may take us some time to do research on the issue. Please be assured we will let you know as soon as the best possible solution is found
Posted 30 Jul, 2007 16:43:02 Top
tao wen




Posts: 12
Joined: 2007-07-30
I tried to handle GiveFeedback event handler, but it was not being called at all. But QueryContinueDrag has been called, and I returned continue. It seems that the wpf can act as drop source, but failed to act as drop target.
Posted 30 Jul, 2007 22:21:54 Top
tao wen




Posts: 12
Joined: 2007-07-30
fixed by:

Loaded += delegate
{
IntPtr windowHandle = new WindowInteropHelper(this).Handle;
typeof (DragDrop).GetMethod("RegisterDropTarget", BindingFlags.Static | BindingFlags.NonPublic).
Invoke(null, new object[] {windowHandle});
};
Posted 30 Jul, 2007 23:30:08 Top