Context Menu

Similar to Windows FileExplorer, the Telerik ExplorerControl also shows the standard Windows context menu:

file-dialogs-context-menu 001

You cannot modify files/folders context menu but you can choose to cancel its opening or modify the empty space context menu items.

The ShellContextMenuOpening event occurs when the context menu is about to open. You can use it to cancel the menu opening or to add/remove options from the short menu (the one opened when the cursor is on an empty space in the explorer).

Modify ShellContextMenu

private void RadForm_Load(object sender, EventArgs e)
{
    RadOpenFolderDialog openFolderDialog = new RadOpenFolderDialog();
    openFolderDialog.OpenFolderDialogForm.ExplorerControl.ShellContextMenuOpening += ExplorerControl_ShellContextMenuOpening;
}
private void ExplorerControl_ShellContextMenuOpening(object sender, Telerik.WinControls.FileDialogs.ContextMenuOpeningEventArgs e)
{
    e.Cancel = true;
    if (e.IsOpeningOnEmptySpace)
    {
        e.Cancel = false;
        e.ShortContextMenuOptions = ShortContextMenuOptions.NewFolder | ShortContextMenuOptions.View;
    }
}

Private Sub RadForm_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim openFolderDialog As RadOpenFolderDialog = New RadOpenFolderDialog()
    AddHandler openFolderDialog.OpenFolderDialogForm.ExplorerControl.ShellContextMenuOpening, AddressOf ExplorerControl_ShellContextMenuOpening
End Sub
Private Sub ExplorerControl_ShellContextMenuOpening(ByVal sender As Object, ByVal e As Telerik.WinControls.FileDialogs.ContextMenuOpeningEventArgs)
    e.Cancel = True
    If e.IsOpeningOnEmptySpace Then
        e.Cancel = False
        e.ShortContextMenuOptions = ShortContextMenuOptions.NewFolder Or ShortContextMenuOptions.View
    End If
End Sub

In this article
Not finding the help you need? Improve this article