0
votes

I've created a barebones wpf app in VS2015 community.

Inside the loaded event of the main window, I've set AllowDrop to true.

When I take a single email message from Live Mail 2012, and drag it over my application the cursor changes.

However, if I take two email messages, and try to drop them on my app, I get a no drop icon. Dropping them onto a folder in Windows Explorer however makes a copy of the files.

I've successfully done this in an MFC app, but can't get it to work in WPF, running on Windows 10, targeting .NET 4.6

Any suggestions?

1

1 Answers

0
votes

This is looking like a bug in WPF. The solution I came up with was to replace my drop target with a WinForms drop target which can accept the drop.

xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

...

<WindowsFormsHost Margin="10">
    <wf:Button AllowDrop="True" 
        x:Name="btnDropTarget" Text="Drop Files here"></wf:Button>
</WindowsFormsHost>

After that the drag and drop works when you switch on AllowDrop.

Now I have some winforms restyling work to do.