Free Study Guide for the Windows Presentation Framework exam 70-511: Headered Content Control
Headered controls are similar to other controls, but the headered control is a specific ContentControl class that exposes the Content property and also reveals the Header property.
Use the Header property to categorize the controls primary content, for instance a tab. The header on at tab control is the content on the tab. Headers support text, Image, StackPanel and Rectangle.
- General Header Control information:
https://msdn.microsoft.com/en-us/library/system.windows.controls.headeredcontentcontrol(VS.100).aspx
What is it?
- Provides the base implementation for all controls that contain single content and have a header
- TabControl
- https://msdn.microsoft.com/en-us/library/system.windows.controls.tabcontrol.aspx
- Represents a control that contains multiple items that share the same space on the screen.
- Not available in Windows Phone 7
- TabItem
- https://msdn.microsoft.com/en-us/library/system.windows.controls.tabitem.aspx
- What is it?
- Represents a selectable item inside a TabControl.
- XAML Example at the bottom of the page, includes the use of a TabControl and TabItem
- Not available in Windows Phone 7
- GroupBox
- https://msdn.microsoft.com/en-us/library/system.windows.controls.groupbox.aspx
- Represents a control that creates a container that has a border and a header for user interface (UI) content
- Expander
- https://msdn.microsoft.com/en-us/library/system.windows.controls.expander.aspx
- Represents the control that displays a header that has a collapsible window that displays content
Example of a Grid that has a GroupBox, StackPanel, TabControl with two TabItem, ListBox. The wrap panel is used to keep the ellipse and the TextBlock in the tab. The GroupBox contains an expander which uses a LinearGadient and a TextBlock.
<Page xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" >
<TabControl VerticalAlignment="Bottom"
HorizontalAlignment="Left"
Width="500"
Height="350">
<TabItem Header="Planet of Origin">
What planet are you from?
</TabItem>
<TabItem>
<TabItem.Header>
<WrapPanel>
<Ellipse Width="10"
Height="10"
Fill="PowderBlue"
Margin="0,0,5,0"/>
<TextBlock>
Planetary System
</TextBlock>
</WrapPanel>
</TabItem.Header>
<TabItem.Content>
<GroupBox Header="This is the groupbox" Margin="10">
<Expander Margin="10"
Width="340"
Header="My Expander"
IsExpanded="True"
Foreground="White">
<Expander.Background>
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop
Offset="0"
Color="Red"/>
<GradientStop
Offset="1"
Color="LemonChiffon"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Expander.Background>
<TextBlock
TextWrapping="Wrap"
Foreground="White">
Currently all space aliens are considered to be from
one of the planets in the Solar System.
</TextBlock>
</Expander>
</GroupBox>
</TabItem.Content>
</TabItem>
</TabControl>
</Page>
Reference: Developing Windows Applications with Microsoft Visual Studio 2010 and internet sites as indicated.