Book > C1Book Task-Based Help > Creating a Book |
You can easily create a C1Book control at design time, in XAML, and in code. Note that 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.
At Design Time
To create a C1Book control, complete the following steps:
If you choose, you can customize the control by selecting it and setting properties in the Properties window.
In XAML
To create a C1Book control using XAML markup, complete the following steps:
XAML Copy Code <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="Window1" Title="Window1" Height="230" Width="348">
XAML Copy Code <Grid> <c1:C1Book x:Name="C1Book1" Height="300" Width="450"/> </c1:C1Book> </Grid>
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:
<Grid x:Name="LayoutRoot">
Visual Basic Copy Code Imports C1.WPF Imports C1.WPF.Extended
C# Copy Code using C1.WPF; using C1.WPF.Extended;
Visual Basic Copy CodePublic Sub New() InitializeComponent() Dim c1book1 as New C1Book c1book1.Height = 300 c1book1.Width = 450 LayoutRoot.Children.Add(c1book1) End Sub
C# Copy Code public MainPage() { InitializeComponent(); C1Book c1book1 = new C1Book(); c1book1.Height = 300; c1book1.Width = 450; LayoutRoot.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. Note that 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.