Extended Library for UWP | ComponentOne
Extended Library Overview / Book for UWP / Book for UWP Task-Based Help / Adding Items to a Book
In This Topic
    Adding Items to a Book
    In This Topic

    You can add any sort of arbitrary content to a C1Book control. This includes text, images, layout panels, and other standard and 3rd-party controls. In this example, you'll add a TextBlock control to a C1Book control, but you can customize the steps to add other types of content instead.

    In XAML

    For example, to add a TextBlock control to the book add <TextBlock Text="Hello World!"/> within the <Extended:C1Book> tag so that it appears similar to the following:

    Markup
    Copy Code
    <Extended:C1Book Name="c1book1" Height="300" Width="450">
        <TextBlock Text="Hello World!"/>
    </Extended:C1Book>
    

    In Code

    For example, to add a TextBlock control to the book, add code to the page's constructor so it appears like 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)
        Dim txt1 as New TextBlock
        txt1.Text = "Hello World!"
        c1book1.Items.Add(txt1)
    End Sub
    

    C#
    Copy Code
    public MainPage()
    {
        this.InitializeComponent();
        C1Book c1book1 = new C1Book();
        c1book1.Height = 300;
        c1book1.Width = 450;
        Grid1.Children.Add(c1book1);
    
        TextBlock txt1 = new TextBlock();
        txt1.Text = "Hello World!";
        c1book1.Items.Add(txt1);
    }
    

    What You've Accomplished

    You've added a control to the C1Book control. Run the application and observe that the TextBlock control has been added to the C1Book control. You can similarly add other content and controls.

    See Also