ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / TopicBar Tasks / Adding and Removing TopicBar Items / Adding Topic Pages to the TopicBar
In This Topic
    Adding Topic Pages to the TopicBar
    In This Topic

    There are five ways to add a page to the topic bar: you can use the smart tag, the floating toolbar, the context menu, the collection editor, or code. In this topic, you will learn how to add pages to the topic bar using each of these five methods.

    Using the Smart Tag

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default.
    2. Click C1TopicBars smart tag (smart tag) to open the C1TopicBar Tasks menu.
    3. On the C1TopicBar Tasks menu, click Add Page.

      TopicBar Tasks menu

      Page 2 is added to the C1TopicBar control.

    Using the Floating Toolbar

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default.
    2. Click the C1TopicBar control's chevron button to activate the floating toolbar. The floating toolbar will appear on the page as follows:
      toolbar
    3. On the floating toolbar, select the Add topic page button Floating toolbar .

      Page 2 is added to the C1TopicBar control.

    Using the Context Menu

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default.
    2. Right-click on the C1TopicBar control to open its context menu.
    3. From the context menu, select Add Page.

      Context menu

      Page 2 is added to the C1TopicBar control.

    Using the Collection Editor

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default.
    2. Click C1TopicBar's smart tag (Smart tag) to open the C1TopicBar Tasks menu.
    3. On the C1TopicBar Tasks menu, click Edit Pages.
      Edit Pages
      The C1TopicPage Collection Editor opens.
    4. Click Add to add a page to the collection.
    5. Click OK to close the C1TopicPage Collection Editor.

      Page 2 is added to the C1TopicBar control.

    Using Code

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default.
    2. Double-click the empty portion of the form to open Code view. Notice that a Form_Load event handler has been added to Code view.
    3. Import the following namespace into the project:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Imports C1.Win.C1Command
      

      To write code in C#

      C#
      Copy Code
      using C1.Win.C1Command;
      
    4. Add the following code, which creates the new topic page and adds it to the topic bar, to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      'Create new topic page object named "Page 2"
      Dim c1TopicPage2 As New C1TopicPage("Page 2")
      'Add new topic page to topic
      c1TopicBar1.Pages.Add(c1TopicPage2)
      

      To write code in C#

      C#
      Copy Code
      //Create new topic page object named "Page 2"
      C1TopicPage c1TopicPage2 = new C1TopicPage("Page 2");
      //Add new topic page to topic 
      c1TopicBar1.Pages.Add(c1TopicPage2);
      
    5. Press F5 to build the project and observe that a new page, named Page 2, appears on the control.

    This topic illustrates the following:

    In this topic, you have learned to add a page to the C1TopicBar control using five separate methods. No matter which method you used, the final result of this topic will appear as follows:


    Page buttons
    See Also