Disable/customize context menu in PdfViewer?

5 posts, 1 answers
  1. Axel
    Axel avatar
    2 posts
    Member since:
    Nov 2013

    Posted 21 Nov 2013 Link to this post

    Hi,

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

    Thanks!
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2743 posts

    Posted 22 Nov 2013 Link to this post

    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 >>
  3. Axel
    Axel avatar
    2 posts
    Member since:
    Nov 2013

    Posted 25 Nov 2013 Link to this post

    That works! Thank you!
  4. Damien
    Damien avatar
    65 posts
    Member since:
    Oct 2017

    Posted 18 Apr 2018 in reply to Dimitar Link to this post

    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

  5. Dimitar
    Admin
    Dimitar avatar
    2743 posts

    Posted 18 Apr 2018 Link to this post

    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.
Back to Top