Using the Navigation Message Box Option

C1PdfViewer allows you to add a message box to control navigation away from the PDF document. If a user clicks on a link in the PDF file, the application will give them the option to navigate away from the document or to cancel the navigation request.

Note that in this step you will add a PDF file that is included with the ComponentOne Studio for Windows Phone samples, which are by default installed in the Documents or MyDocuments folder in the ComponentOne Samples\Studio for Windows Phone \ \PdfViewerSamples directory. If you choose, you can instead use another PDF file and adapt the steps.

Complete these steps to create the navigation request:

1.   In the Solution Explorer, right-click on the project name and select Add | Existing Item from the menu. The Add Existing Item dialog box will appear.

2.   Select the sample PDF file, C1XapOptimizer.pdf, and click Add.

3.   Right-click the PDF file you just added in the Solution Explorer and select Properties from the menu. Set the BuildAction property to Resource and confirm that the Copy to Output Directory item is set to Do Not Copy.

4.   Open the XAML view of the Mainpage.xaml file and add the following markup to create the C1PdfViewer component:

<c1pdfviewer:C1PdfViewer x:Name="pdfViewer" ViewMode="FitWidth" />

5.   Open the Code View by right-clicking on the document and add the following imports statement:

      Visual Basic

      C#

6.   Add the following code after the InitializeComponent() method:

      Visual Basic

      C#

7.   Press F5 to run your application. Locate a link in the PDF document and click on it. The Navigation Message Box should appear as in the following image:

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.