HypernovaDesktop Components · docs
Binarymission
WPF › Backstage Tab Control › BackstageTabControl

BackstageTabControl

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Office

A custom class that provides a standalone Tab control that mimics the MS Office Backstage tab control system.

public class BackstageTabControl : TabControl

Inherits from / implements: TabControl

Remarks

How this control works. Like the rest of the Office family it carries no code beyond its properties: it is a TabControl with a template that lays the tab headers down the left as a menu and the selected tab's content to the right. Every setting here is read by that template through a FindAncestor binding, so a property added here does nothing until the template binds it. Every brush default is frozen. A dependency property's default is one object shared by every instance in the process. Left unfrozen, a caller who reaches a default brush and recolours it recolours every backstage view in the application - and a frozen brush is also cheaper to render, which matters for the radial gradient behind the selection. The menu's colours do not come from the system. The menu background defaults to a fixed light grey, so the text on it must default to a fixed dark colour rather than to the system's menu text colour: on a machine in a dark theme that colour is near-white and the menu would be white text on light grey. MenuItemForegroundBrush is the property to set when MenuBackgroundBrush is changed. A frozen default and an animation cannot both be had. The selected item's text colour is a second brush and a trigger, not an animation over the first brush's colour. An animation writes to whatever object the property points at, which for a dependency property's default is the one object the whole process shares - so it either changes every instance at once or, once that object is frozen, throws.

Members at a glance

HoverTabItemBackgroundBrushGets or sets the hover tab item background brush.
HoverTabItemBorderBrushGets or sets the hover tab item border brush.
MenuBackgroundBrushGets or sets the menu background brush.
MenuBorderBrushGets or sets the menu border brush.
MenuBorderThicknessGets or sets the menu border thickness.
MenuFontFamilyGets or sets the menu font family.
MenuFontSizeGets or sets the size of the menu font.
MenuItemForegroundBrushGets or sets the brush the menu item text is drawn in.
MenuItemHeightGets or sets the height of the menu item.
MenuItemSelectedForegroundBrushGets or sets the brush the selected menu item's text is drawn in.
MenuItemSelectedStateBorderBrushGets or sets the menu item selected state border brush.
MenuItemSelectedStateBorderThicknessGets or sets the menu item selected state border thickness.
MenuItemSelectedStateFillBrushGets or sets the menu item selected state fill brush.
MenuItemSelectionPointerStemPathDataGets or sets the menu item selection pointer stem path data.
MenuItemWidthGets or sets the width of the menu item.
HoverTabItemBackgroundBrushPropertyThe hover tab item background brush property
HoverTabItemBorderBrushPropertyThe hover tab item border brush property
MenuBackgroundBrushPropertyThe menu background brush property
MenuBorderBrushPropertyThe menu border brush property
MenuBorderThicknessPropertyThe menu border thickness property
MenuFontFamilyPropertyThe menu font family property
MenuFontSizePropertyThe menu font size property
MenuItemForegroundBrushPropertyThe menu item foreground brush property
MenuItemHeightPropertyThe menu item height property
MenuItemSelectedForegroundBrushPropertyThe menu item selected foreground brush property
MenuItemSelectedStateBorderBrushPropertyThe menu item selected state border brush property
MenuItemSelectedStateBorderThicknessPropertyThe menu item selected state border thickness property
MenuItemSelectedStateFillBrushPropertyThe menu item selected state fill brush property
MenuItemSelectionPointerStemPathDataPropertyThe menu item selection pointer stem path data property
MenuItemWidthPropertyThe menu item width property

Properties

HoverTabItemBackgroundBrush

public Brush HoverTabItemBackgroundBrush

Gets or sets the hover tab item background brush.

Value. The hover tab item background brush.

HoverTabItemBorderBrush

public Brush HoverTabItemBorderBrush

Gets or sets the hover tab item border brush.

Value. The hover tab item border brush.

MenuBackgroundBrush

public Brush MenuBackgroundBrush

Gets or sets the menu background brush.

Value. The menu background brush.

MenuBorderBrush

public Brush MenuBorderBrush

Gets or sets the menu border brush.

Value. The menu border brush.

MenuBorderThickness

public Thickness MenuBorderThickness

Gets or sets the menu border thickness.

Value. The menu border thickness.

MenuFontFamily

public FontFamily MenuFontFamily

Gets or sets the menu font family.

Value. The menu font family.

MenuFontSize

public double MenuFontSize

Gets or sets the size of the menu font.

Value. The size of the menu font.

MenuItemForegroundBrush

public Brush MenuItemForegroundBrush

Gets or sets the brush the menu item text is drawn in.

Value. The menu item foreground brush.

Set this whenever MenuBackgroundBrush is set. The two defaults are a matched pair - dark text on a light grey column - and neither follows the machine's theme, so a dark menu background with the default text is a menu that cannot be read.

MenuItemHeight

public double MenuItemHeight

Gets or sets the height of the menu item.

Value. The height of the menu item.

MenuItemSelectedForegroundBrush

public Brush MenuItemSelectedForegroundBrush

Gets or sets the brush the selected menu item's text is drawn in.

Value. The selected menu item foreground brush.

The template switches between this brush and MenuItemForegroundBrush with a trigger. It does not animate a colour through either of them, because an animation writes to whatever object the property points at, and a dependency property's default is one object shared by the whole process.

MenuItemSelectedStateBorderBrush

public Brush MenuItemSelectedStateBorderBrush

Gets or sets the menu item selected state border brush.

Value. The menu item selected state border brush.

MenuItemSelectedStateBorderThickness

public Thickness MenuItemSelectedStateBorderThickness

Gets or sets the menu item selected state border thickness.

Value. The menu item selected state border thickness.

MenuItemSelectedStateFillBrush

public Brush MenuItemSelectedStateFillBrush

Gets or sets the menu item selected state fill brush.

Value. The menu item selected state fill brush.

MenuItemSelectionPointerStemPathData

public Geometry MenuItemSelectionPointerStemPathData

Gets or sets the menu item selection pointer stem path data.

Value. The menu item selection pointer stem path data.

MenuItemWidth

public double MenuItemWidth

Gets or sets the width of the menu item.

Value. The width of the menu item.

Fields

HoverTabItemBackgroundBrushProperty

public static readonly DependencyProperty HoverTabItemBackgroundBrushProperty

The hover tab item background brush property

HoverTabItemBorderBrushProperty

public static readonly DependencyProperty HoverTabItemBorderBrushProperty

The hover tab item border brush property

MenuBackgroundBrushProperty

public static readonly DependencyProperty MenuBackgroundBrushProperty

The menu background brush property

MenuBorderBrushProperty

public static readonly DependencyProperty MenuBorderBrushProperty

The menu border brush property

MenuBorderThicknessProperty

public static readonly DependencyProperty MenuBorderThicknessProperty

The menu border thickness property

MenuFontFamilyProperty

public static readonly DependencyProperty MenuFontFamilyProperty

The menu font family property

MenuFontSizeProperty

public static readonly DependencyProperty MenuFontSizeProperty

The menu font size property

MenuItemForegroundBrushProperty

public static readonly DependencyProperty MenuItemForegroundBrushProperty

The menu item foreground brush property

MenuItemHeightProperty

public static readonly DependencyProperty MenuItemHeightProperty

The menu item height property

MenuItemSelectedForegroundBrushProperty

public static readonly DependencyProperty MenuItemSelectedForegroundBrushProperty

The menu item selected foreground brush property

MenuItemSelectedStateBorderBrushProperty

public static readonly DependencyProperty MenuItemSelectedStateBorderBrushProperty

The menu item selected state border brush property

MenuItemSelectedStateBorderThicknessProperty

public static readonly DependencyProperty MenuItemSelectedStateBorderThicknessProperty

The menu item selected state border thickness property

MenuItemSelectedStateFillBrushProperty

public static readonly DependencyProperty MenuItemSelectedStateFillBrushProperty

The menu item selected state fill brush property

MenuItemSelectionPointerStemPathDataProperty

public static readonly DependencyProperty MenuItemSelectionPointerStemPathDataProperty

The menu item selection pointer stem path data property

MenuItemWidthProperty

public static readonly DependencyProperty MenuItemWidthProperty

The menu item width property