TabControl Class
NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Controls
A tabbed container: a strip of tab headers over a body that shows the selected tab's content. Add tabs with AddTab(string, UIElement); tapping a header selects it. A header is either a plain text label or, like WPF's TabItem.Header, any UIElement (an Image, a StackPanel of icon + text, …).
public class TabControl : Control
Properties
TabColor
public Color TabColor { get; set; }
Fill of an unselected tab header.
SelectedTabColor
public Color SelectedTabColor { get; set; }
Fill of the selected tab header (and the body).
HeaderColor
public Color HeaderColor { get; set; }
Colour of the header text and separators.
HeaderHeight
public int HeaderHeight { get; set; }
Height in pixels of the tab-header strip.
SelectedIndex
public int SelectedIndex { get; set; }
The index of the visible tab. May be set before tabs are added (it is clamped when rendering).
Methods
AddTab(string header, UIElement content)
public void AddTab(string header, UIElement content)
Adds a tab with a plain text header and content element.
AddTab(UIElement header, UIElement content)
public void AddTab(UIElement header, UIElement content)
Adds a tab whose header is an arbitrary UIElement — WPF's TabItem.Header model. Pass an Image, a StackPanel of icon + text, or any control; it is measured and centred in the header, and clipped to the tab. A null header shows an empty tab.
MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)
protected override void MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)
Measures each tab's header (in its strip slot) and content (against the body area).
ArrangeOverride(int arrangeWidth, int arrangeHeight)
protected override void ArrangeOverride(int arrangeWidth, int arrangeHeight)
Arranges each UIElement header centred in its strip slot, and the selected tab's content in the body (collapsing the rest).
OnTouchUp(TouchEventArgs e)
protected override void OnTouchUp(TouchEventArgs e)
Selects the tapped tab header.
OnRender(DrawingContext dc)
public override void OnRender(DrawingContext dc)
Draws the tab-header backgrounds and separators. String headers are drawn here; UIElement headers are rendered by the framework (as children) on top of the backgrounds.