.

Allow explorer file drag & drop onto a control

This code will accept explorer files to be dragged & dropped on the control:

listViewFiles.AllowDrop = true;

listViewFiles.DragEnter += (sender, args) =>
    {
        if (args.Data.GetDataPresent(DataFormats.FileDrop))
            args.Effect = DragDropEffects.Copy; 
        else
            args.Effect = DragDropEffects.None;
    };

listViewFiles.DragDrop += (sender, args) =>
    {
        var FileList = (string[]) args.Data.GetData(DataFormats.FileDrop, false);
        foreach (string File in FileList)
        {
            //AddFileUpload(File);
        }
    };

What's your thoughts on this?

*

Protected by WP Anti Spam