Add Button to Navigator

6 posts, 1 answers
  1. Samantha
    Samantha avatar
    21 posts
    Member since:
    Apr 2009

    Posted 11 Jul 2013 Link to this post

    Hello.  I would like to add a "Save As" button and an "Email" button to the RadPdfViewerNavigator.  Is this possible to do?
  2. Answer
    George
    Admin
    George avatar
    500 posts

    Posted 11 Jul 2013 Link to this post

    Hi Samantha,

    Thank you for writing.

    You can add custom buttons to the RadPdfViewerNavigator like this:
    CommandBarButton btn = new CommandBarButton();
    this.radPdfViewerNavigator1.CommandBarElement.Rows[0].Strips[0].Items.Add(btn);

    You can remove and insert buttons also like with normal collection. You can also subscribe for the Click event of the button and change it's image.

    I hope this helps.
     
    Regards,
    George
    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. UI for WinForms is Visual Studio 2017 Ready
  4. TB
    TB avatar
    23 posts
    Member since:
    Jun 2010

    Posted 30 Jul 2013 Link to this post

    A couple more questions related:
    1.I added programmatically a button to the navigator bar. Where can I find the handler for the newly created button so I can add my code there?
    2.How do you add to the new created button the save image?
    3.I don't wish the users to add/modify the buttons they can see on the pdf navigator. What should I do to disallow this?
  5. George
    Admin
    George avatar
    500 posts

    Posted 02 Aug 2013 Link to this post

    Hi TB,

    Thank you for writing.

    We will use the following code for reference:
    CommandBarButton btn = new CommandBarButton();
    this.radPdfViewerNavigator1.CommandBarElement.Rows[0].Strips[0].Items.Add(btn);

    1. The button element has events just like other buttons do. The click event can be used as follows:
      btn.Click += btn_Click;
    2. The button also has an Image property which you can change very easy:
      btn.Image = Image.FromFile("MyImg.png");
    3. if you do not want your users to remove and add buttons you can hide the overflow button with the code below:
      this.radPdfViewerNavigator1.CommandBarElement.Rows[0].Strips[0].OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;

    I hope this helps.

    Regards,
    George
    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 >>
  6. Ken Hawley
    Ken Hawley avatar
    8 posts
    Member since:
    Apr 2008

    Posted 13 Dec 2013 Link to this post

    This little trick:

    this.radPdfViewerNavigator1.CommandBarElement.Rows[ 0 ].Strips[ 0 ].OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;

    needs to be included prominently in the docs for this control.  It was the first thing I wanted to do and I wasted a lot of time hunting it down here.

    It is not exactly intuitively obvious that is the way to disable the customization menu.

    How about a property at the top level ... AllowUserCustomization?

  7. George
    Admin
    George avatar
    500 posts

    Posted 18 Dec 2013 Link to this post

    Hi Ken,

    Thank you for replying.

    Actually, we have documentation about RadCommandBar which is used in RadPdfViewerNavigator. For example you can see its structure here: Structure. And on the following url you can see how to use it at design time, which is very much similar to the approach in runtime: Design-Time. And here you can see how to modify the overflow button of each CommandBarStripElement.

    I hope this helps.

    Regards,
    George
    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready