Represents a selectable item inside a TabControl.

Namespace: DigitalRune.Game.UI.Controls
Assembly: DigitalRune.Game.UI (in DigitalRune.Game.UI.dll) Version: 1.1.0.0 (1.1.1.9392)

Syntax

C#
public class TabItem : ContentControl
Visual Basic
Public Class TabItem _
	Inherits ContentControl
Visual C++
public ref class TabItem : public ContentControl

Remarks

The TabItem is the clickable tab that the user clicks to switch to this tab. If this TabItem is selected, the TabPage of this control is displayed in the TabControl.

Visual States: The VisualStates of this control are: "Disabled", "Default", "MouseOver", "Selected"

Examples

The following example creates a tab controls containing 3 tab items:
C# Copy imageCopy
var tabControl = new TabControl
{
  HorizontalAlignment = HorizontalAlignment.Stretch,
  Margin = new Vector4F(4)
};

// Add 3 pages to to the tab control.
var tabItem0 = new TabItem
{
  TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 0" },
  Content = new TextBlock { Text = "Content of page 0" }
};
var tabItem1 = new TabItem
{
  TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 1" },
  Content = new TextBlock { Text = "Content of page 1" }
};
var tabItem2 = new TabItem
{
  TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 2" },
  Content = new TextBlock { Text = "Content of page 2" }
};
tabControl.Items.Add(tabItem0);
tabControl.Items.Add(tabItem1);
tabControl.Items.Add(tabItem2);

// Select the second page.
tabControl.SelectedIndex = 1;

// To show the tab control, add it to an exising content control or panel.
panel.Children.Add(tabControl);

Inheritance Hierarchy

See Also