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

Add Button to Navigator

5 Answers 193 Views
PdfViewer and PdfViewerNavigator
This is a migrated thread and some comments may be shown as answers.
Samantha
Top achievements
Rank 1
Samantha asked on 11 Jul 2013, 04:10 PM
Hello.  I would like to add a "Save As" button and an "Email" button to the RadPdfViewerNavigator.  Is this possible to do?

5 Answers, 1 is accepted

Sort by
0
Accepted
George
Telerik team
answered on 12 Jul 2013, 04:39 AM
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 >>
0
Tofan
Top achievements
Rank 1
answered on 30 Jul 2013, 10:41 AM
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?
0
George
Telerik team
answered on 02 Aug 2013, 08:41 AM
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 >>
0
Ken Hawley
Top achievements
Rank 1
answered on 13 Dec 2013, 08:52 PM
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?

0
George
Telerik team
answered on 18 Dec 2013, 12:19 PM
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 >>
Tags
PdfViewer and PdfViewerNavigator
Asked by
Samantha
Top achievements
Rank 1
Answers by
George
Telerik team
Tofan
Top achievements
Rank 1
Ken Hawley
Top achievements
Rank 1
Share this question
or