Step 1 of 3: Creating the C1PdfViewer Application

In this step you'll create a Windows Phone application using PdfViewer for Windows Phone. When you add a C1PdfViewer control to your application, you'll have a complete, functional document viewer interface that you can display PDF and HTML files in. To set up your project and add a C1PdfViewer control to your application, complete the following steps:

1.   Create a new Windows Phone project in Visual Studio. In this example the application will be named "QuickStart". If you name the project something else, in later steps you may need to change references to "QuickStart" with the name of your project.

2.   In the Solution Explorer, right-click the project name and choose Add Reference. In the Add Reference dialog box, locate and select the C1.Phone.PdfViewer assembly and click OK to add references to your project.

3.   Open the XAML view of the MainPage.xaml file; in this quick start you'll add the C1PdfViewer control using XAML markup.

4.   Add the XAML namespace to the <phone:PhoneApplicationPage> tag with the following markup: xmlns:c1pdfviewer="clr-namespace:C1.Phone.PdfViewer;assembly=C1.Phone.PdfViewer".

The <phone:PhoneApplicationPage> tag will now appear similar to the following:

<phone:PhoneApplicationPage x:Class="QuickStart.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:c1pdfviewer="clr-namespace:C1.Phone.PdfViewer;assembly=C1.Phone.PdfViewer" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True">

5.   Add the <c1:C1PdfViewer x:Name="C1PdfViewer1" /> tag within the Grid tags on the page to add the C1PDFViewer control to the application.

The XAML will appear similar to the following:

<Grid>

    <c1pdfviewer:C1PdfViewer x:Name="C1PdfViewer1" />

</Grid>

This will add a C1PdfViewer control named "C1PdfViewer1" to the application.

You've successfully set up your application's user interface, but if you run your application now you'll see that the C1PdfViewer control currently contains no content. In the next steps you'll add content to the C1PdfViewer control, and then you'll observe some of the run-time interactions possible with the control.


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