Click or drag to resize

JamBaseShellListViewBeforeShellDrop Event

This event is fired before a ListView that inherits from JamBaseShellListView executes a shell drop.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
public event EventHandler<BeforeShellDropEventArgs> BeforeShellDrop


Type: SystemEventHandlerBeforeShellDropEventArgs
This example shows, how you can rename dropped files automatically.
using Jam.Shell;
using System.IO;

private PathCollection m_DroppedFiles;

private void shellListView1_BeforeShellDrop(object sender, BeforeShellDropEventArgs e)
    // maybe clear if old dropped files are present
    if (m_DroppedFiles != null)

    // If you don`t want the ShellDrop to be executed, just set the flag to false
    if (...)
        e.ExecuteShellDrop = false;

    /* - possibility to watch what is dropped
    for (int i = 0; i < e.Files.Count; i++)

    // save the dropped files
    // here you could filter the files that should later be renamed
    m_DroppedFiles = e.Files;

private void shellListView1_OperationPerformed(object sender, OperationEventArgs e)
    if (e.Operation == ShellOperation.Drop)
        // fill a new PathCollection, because the AffectedObjects will change during the rename process
        PathCollection localDroppedFiles = new PathCollection(e.AffectedObjects);

        // use a temporary ShellBrowser instance
        using (ShellBrowser sb = new ShellBrowser())
            // set the ShellBrowser folder to the drop destination
            sb.Folder = e.Destination;

            foreach (string objectPath in localDroppedFiles)
                // if the affected object can be found in our list,  rename it
                if (m_DroppedFiles != null && m_DroppedFiles.Contains(objectPath))
                    // set the objectname to the filename of the  dropped file
                    sb.ObjectName = Path.GetFileName(objectPath);

                    // delete it from the list 

                    // rename

                    // show the new name
See Also