RichTextBox for WinRT
Step 1 of 4: Setting up the Application

In this step, you'll create a new Windows Store application, add a C1RichTextBox control, and add the markup to create the C1RichTextBox control and a C1RichTextBoxMenu control.

  1. Select File | New | Project to open the New Project dialog box.
  1. Select Windows Store under C# in the right-hand pane.
  1.  In the left-hand pane, select Blank App (XAML).
  1.  Enter a name for your application and click OK. A new, blank Windows Store application will open.
  1. In the Solution Explorer, right-click the References file and select Add Reference from the list. Browse to locate the following assembly references:
  1.  Double-click the MainPage.xaml file to open it.
  1.  Add the following namespace declaration to the <Page> tag at the top of the page:
XAML
Copy Code
xmlns:c1RTB="using:C1.Xaml.RichTextBox"
  1. Next, you'll add some Grid.Resources and RowDefinitions. The following markup should be placed between the <Grid> </Grid> tags:
XAML
Copy Code
<Grid.Resources>
            <DataTemplate x:Name="printTemplate">
                <Grid Height="{Binding ViewManager.PresenterInfo.Height}" Width="{Binding ViewManager.PresenterInfo.Width}">
                    <c1RTB:C1RichTextPresenter Source="{Binding}" Margin="{Binding ViewManager.PresenterInfo.Padding}" />
                </Grid>
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
  1. Right below the closing </Grid.RowDefinitions> tag, add a general Button control. Edit the markup so that it resembles the following. You'll add a Name, the Content, and a Click event:
XAML
Copy Code
<Button x:Name="btnPrint" Content="Print" HorizontalAlignment="Left" Click="btnPrint_Click" />
  1. Finally, add a C1RichTextBoxMenu control and a C1RichTextBox control by locating the controls in the Visual Studio ToolBox and double-clicking them. Edit the markup to resemble the following:
XAML
Copy Code
<c1RTB:C1RichTextBoxMenu x:Name="rtbMenu" RichTextBox="{Binding ElementName=rtb}" Grid.Row="1" />
<c1RTB:C1RichTextBox x:Name="rtb"  Grid.Row="1"
                             FontFamily="Times New Roman"
                             FontSize="20"
                             ViewMode="Print"
                             HorizontalContentAlignment="Center"
                             Background="#EEEEEE"/>

 In this step, you set up a new Windows Store application, added the appropriate references for the application, and added C1RichTextBox controls to the application. In the next step, you'll add the appropriate resource files and some application code.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback