New to Telerik UI for WinForms? Download free 30-day trial

Context Menu

RadPdfViewer has a default context menu - PdfViewerContextMenu which provides a quick way of performing a number of commands. However, you can replace this menu with a custom one by setting the RadContextMenu property of the RadPdfViewer.

New Context Menu

this.radPdfViewer1.RadContextMenu = this.radContextMenu1;

Me.radPdfViewer1.RadContextMenu = Me.radContextMenu1

You can also use the ShowMenu method to show the context menu programmatically at a specified location.

Show Context Menu

private void buttonShowMenu_Click(object sender, EventArgs e)
    this.radPdfViewer1.PdfViewerElement.ShowMenu(new Point(100, 100));

Private Sub buttonShowMenu_Click(sender As Object, e As EventArgs) Handles buttonShowMenu.Click
    Me.radPdfViewer1.PdfViewerElement.ShowMenu(New Point(100, 100))
End Sub

The context menu can change dynamically. For example, when the Text Selection mode is enabled, Copy and Select All items are displayed in the menu with a separator below them:

FixedDocumentViewerMode.Pan FixedDocumentViewerMode.TextSelection
WinForms RadPdfViewer FixedDocumentViewerMode Pan WinForms RadPdfViewer FixedDocumentViewerMode TextSelection

Additionally, you can easily add a custom menu item to the context menu. You can find below a sample code snippet:

Add New Menu Item

public PdfUI()
    RadMenuItem item = new RadMenuItem("MyItem");
    item.Click += item_Click;
private void item_Click(object sender, EventArgs e)
    RadMessageBox.Show("Perform your custom action here");

Public Sub New()
    Dim item As New RadMenuItem("MyItem")
    AddHandler item.Click, AddressOf item_Click
End Sub
Private Sub item_Click(sender As Object, e As EventArgs)
    RadMessageBox.Show("Perform your custom action here")
End Sub

See Also

In this article