This is a migrated thread and some comments may be shown as answers.

Disable/customize context menu in PdfViewer?

4 Answers 149 Views
PdfViewer and PdfViewerNavigator
This is a migrated thread and some comments may be shown as answers.
Axel
Top achievements
Rank 1
Axel asked on 22 Nov 2013, 12:58 AM
Hi,

how can one completely disable or customize the context menu in the Pdf Viewer control?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 22 Nov 2013, 04:57 PM
Hi Axel,

Thank you for writing.

To disable or customize the context menu you can use the DropDownOpening event. If you want to disable it you can just cancel the opening like this:
void RadContextMenu_DropDownOpening(object sender, CancelEventArgs e)
{
    e.Cancel = true;
}

Also with the following code snipped you can remove a specific item for example:
void RadContextMenu_DropDownOpening(object sender, CancelEventArgs e)
{
    foreach (var item in radPdfViewer1.RadContextMenu.Items)
    {
        if (item.Text == "&Next Page")
        {
            item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
        }
    }
}

Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Axel
Top achievements
Rank 1
answered on 25 Nov 2013, 10:10 AM
That works! Thank you!
0
Damien
Top achievements
Rank 1
answered on 18 Apr 2018, 07:50 AM

Sorry to jump pin on this, but I have tried to find anywhere to use your code to disable the right-click context menu, and I can't find it.

Is this still relevant, or am I looking at it all wrong?

thanks.

Damien

0
Dimitar
Telerik team
answered on 18 Apr 2018, 11:16 AM
Hello Damien,

Yes, this code still works. Here is how to subscribe to the event:
public RadForm1()
{
    InitializeComponent();
    radPdfViewer1.RadContextMenu.DropDownOpening += RadContextMenu_DropDownOpening;
}
 
private void RadContextMenu_DropDownOpening(object sender, CancelEventArgs e)
{
    e.Cancel = true;
}

Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
PdfViewer and PdfViewerNavigator
Asked by
Axel
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Axel
Top achievements
Rank 1
Damien
Top achievements
Rank 1
Share this question
or