views:

91

answers:

0

Hi,

I have a window set to allow drop and my Drop Event Handler is working fine for images dragged in from Windows Explorer. But dragging in pictures from a web browser has some quirks.

In Firefox, I am only getting .bmp files with random names. Images from IE 8 (haven't tested others) only show a Not Allowed mouse cursor. I guess this is because IE has a security prompt when dragging images out into the Windows Explorer.

Has anyone come across a solution, perhaps browser-agnostic, for dragging images out of a web browser and into a WPF window?

Here's the current event handler:

private void Window_Drop(object sender, DragEventArgs e)
    {
        if (e.Data.GetDataPresent(DataFormats.FileDrop))
        {
            string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[];

            foreach (string droppedFilePath in droppedFilePaths)
            {
                Debug.WriteLine(droppedFilePath);
            }
        }
    }