Step 1 of 4: Creating an Application with the C1PdfDocument Object
In this step, you'll create a Windows Phone application and add a C1PdfDocument object.
1. In Visual Studio 2010, select File | New | Project to open the New Project dialog box.
2. In the New Project dialog box, select a language in the left pane, and in the templates list select Windows Phone Application. Enter a Name for your project and click OK. The New Windows Phone Application dialog box will appear.
3. Click OK to close the New Windows Phone Application dialog box and create your project.
4. Right-click the project in the Solution Explorer and select Add Reference.
5. In the Add Reference dialog box, locate and select the C1.Phone.dll¸ C1.Phone.Pdf.dll¸ and C1.Phone.PdfViewer.dll files and click OK to add the references to your project.
6. Open the MainPage.xaml file.
7. Edit the TitlePanel content to change the text in the TextBlock controls. It will appear similar to the following:
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="ComponentOne Studio for Windows Phone" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="PDF" FontSize="56" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
8. Add the C1PdfViewer XAML namespace to the <phone:PhoneApplicationPage> tag by adding xmlns:my="clr-namespace:C1.Phone;assembly=C1.Phone.PdfViewer" so it appears similar to the following:
<phone:PhoneApplicationPage x:Class="C1WP7.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" 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" xmlns:my="clr-namespace:C1.Phone.PdfViewer;assembly=C1.Phone.PdfViewer">
9. Edit the TitlePanel content to change the text in the TextBlock controls. It will appear similar to the following:
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="ComponentOne Studio for Windows Phone" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="PDF" FontSize="56" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
10. Add the following markup between the <Grid x:Name="ContentPanel"></Grid> tags to add a Button and a C1PdfViewer control to the application:
<StackPanel>
<Button x:Name="btnText" Content="Create PDF" Click="HandleButtonClick" Margin="20" />
<my:C1PdfViewer Name="pdfViewer" />
</StackPanel>
You'll add code to initialize the HandleButtonClick event in the next step.
You've successfully created a Windows Phone application.