ComponentOne Extended Library for UWP
Creating a Book
Extended Library for UWP > Book for UWP > Book for UWP Task-Based Help > Creating a Book

You can easily create a C1Book control at design time in XAML and in Code.

If you create a C1Book control as in the following steps, it will appear as an empty container. You will need to add items to the control for it to appear as a book at run time. For an example, see Adding Items to a Book.

In XAML

To create a C1Book control using XAML markup, complete the following steps:

  1. In the Visual Studio Solution Explorer, right-click the References folder in the project files list. In the context menu choose Add Reference, select UWP Edition, and click OK.
  2. Place your cursor between the <Grid> and </Grid> tags. Double-click the C1Book control in the Visual Studio Toolbox to add it to your application. This will also add the following namespace to the <Page> tag:
Markup
Copy Code
xmlns:Extended="using:C1.Xaml.Extended"
  1. Add the following to the <Extended: C1Book> tag:
  • Name="c1book1"
  • Height="300"
  • Width="450"

This markup will create an empty C1Book control named "c1book1" and set the control's size.

In Code

To create a C1Book control in code, complete the following steps:

  1. In the Visual Studio Solution Explorer, right-click the References folder in the project files list. In the context menu choose Add Reference, select UWP Edition, and click OK.
  2. In the MainPage.xaml window, place your cursor within the <Grid> tag and add the following:
  • Name="Grid1"
  1. Right-click within the MainPage.xaml window and select View Code to switch to Code view.
  2. Add the following import statements to the top of the page:
Visual Basic
Copy Code
Imports C1.Xaml.Extended

C#
Copy Code
using C1.Xaml.Extended;
  1. Add code to the page's constructor to create the C1Book control. It will look similar to the following:
Visual Basic
Copy Code
Public Sub New()
    InitializeComponent()
    Dim c1book1 as New C1Book
    c1book1.Height = 300
    c1book1.Width = 450
    Grid1.Children.Add(c1book1)
End Sub

C#
Copy Code
public MainPage()
{
    this.InitializeComponent();
    C1Book c1book1 = new C1Book();
    c1book1.Height = 300;
    c1book1.Width = 450;
    Grid1.Children.Add(c1book1);
}

This code will create an empty C1Book control named "c1book1", set the control's size, and add the control to the page.

What You've Accomplished

You've created a C1Book control.  When you create a C1Book control as in the above steps, it will appear as an empty container. You will need to add items to the control for it to appear as a book at run time. For an example, see Adding Items to a Book.

See Also