Tab Control Elements

The C1TabControl is comprised of three elements – the tab, the tabstrip and the tab page – that combine to make the complete C1TabControl control.

The following tabbed content explains the elements that make up the C1TabControl.

Each tab on the C1TabControl is represented by the C1TabItem class. The header of the tab is exposed by the Header property of the C1TabItem. Each tab is associated with a tab page (see Tab Page).

Tabs can appear rounded, sloped, or rectangular. When a tab is added to a page, its default appearance is sloped – it looks similar to a tab on an office folder.

You can add a close button to each tab by setting the TabItemClose property to InEachTab. This will allow users to close any tab in the control; however, you can deny users the ability to close a particular tab by setting that tab's CanUserClose property to False.

Adding a Tab

It's easy to add a C1TabItem to a C1TabControl.

  • At Design time, you can select the C1TabControl on your page, and add a C1TabItem by double-clicking the C1TabItem icon in the Toolbox.
  • If you would rather use XAML markup, you can add a C1TabItem using the following markup:
Example Title
Copy Code
<c1:C1TabControl>
  <c1:C1TabItem Content="c1TabItem">
  </c1:C1TabItem>
</c1:C1TabControl>
  • It's also easy to use code to add a C1TabItem. Import the correct namespace first, and then add the following code to the InitializeComponent() method:
Visual Basic
Copy Code
'Create the tab and add content
Dim C1TabItem1 As New C1TabItem()
C1TabItem1.Content = "C1TabItem1"
'Add the tab to the control
c1TabControl1.Items.Add(C1TabItem1)

 

C#
Copy Code
//Create the tab and add content
c1TabItem c1TabItem1 = new c1TabItem();
c1TabItem1.Content = "c1TabItem1";
//Add the tab to the control
c1TabControl1.Items.Add(c1TabItem1);

Customizing the Header

When you want to add something simple to the tab's header, such as an unformatted string, you can simply use the common XML attributes in your XAML markup, such as in the following:

XAML
Copy Code
<c1:C1TabItem Header="Hello World"/>

The Header can also be customized using code:

Visual Basic
Copy Code
C1TabItem1.Header = Hello World

 

C#
Copy Code
c1TabItem1.Header = Hello World;

You can also customize the header using the HeaderTemplate.