ShellTreeViewBeforeShellCommand Event |
Namespace: Jam.Shell
using (ShellBrowser shellBrowser = new ShellBrowser(lFilePath)) { //The following code shows some variants to stop a context menu item from being executed. shellBrowser.BeforeShellCommand += (s, e) => { if (e.Verb == ShellCommand.Open) e.Cancel = true; //this is equivalent to: if (e.Verb == ShellContextMenuCommand.Open) e.Cancel = true; //or if (ShellCommand.IsOpen(e.Verb)) e.Cancel = true; //not all context menu commands have a "verb". If it is empty, then you can at least access the caption: if (ShellCommand.IsEmpty(e.Verb)) System.Diagnostics.Debug.WriteLine(e.Verb.Caption); }; shellBrowser.ShowContextMenu(Cursor.Position); }