Content Index Search
 

SimpleTabControl and SimpleTabItem

The tab control is an items control that displays content in tabs. Typically, the child elements of a tab control are tab items, which are headered content controls, each of which can have a header element and a content element. You can place items in a tab control in Microsoft® Expression Blend™ by right-clicking the tab control under Objects and Timeline, and then clicking Add SimpleTabItem to add individual items to the collection, or by clicking Bind ItemsSource to Data to generate the collection of tab item elements from a data source. .

You can edit the text of the tab item by right-clicking it under Objects and Timeline, and then clicking Edit Text, or you can make the tab item active by double-clicking it and drawing a control into it.

Artboard view: SimpleTabControl

The artboard view of a SimpleTabControl control after two SimpleTabItems are added.

Breaking down the control template

The SimpleTabControl control template consists of the following items:

The SimpleTabItem control template consists of the following items:

Objects view: The basic parts (template) of SimpleTabControl Objects view: The basic parts (template) of SimpleTabControl

Objects view: The basic parts (template) of a SimpleTabControl control (on the left) and a SimpleTabItem control (on the right).

Property triggers used

Property triggers in the control template are used to make the control react to property changes. You can click the items under Triggers in the Interaction panel to view the properties that are changed when a trigger is active. For example, in the template for the tab item, the trigger for IsSelected sets the ZIndex property on the tab item, which forces it to the front. For this reason, this trigger needs to be kept if the tab item is to work correctly. The IsSelected trigger also sets a thicker BorderThickness and changes the Background color to show that the item is selected.

Brushes used

The following brush resources in the SimpleStyles.xaml resource dictionary are used by the SimpleTabControl and SimpleTabItem templates:

Additionally, the templates use bindings to system colors, which allow the controls to use the system defaults. In many cases, you may want to change these brushes so you can create a unique design. You can do this by editing the triggers that set the system colors.

Best practices and design guidelines

Try it!