TabControl
A custom TabControl class that provides extended set of features.
public class TabControl : System.Windows.Controls.TabControl
Inherits from / implements: System.Windows.Controls.TabControl
Remarks
How this control works. Everything visible is in the default style ( Themes\Generic.xaml ). TabStripPlacement picks one of four control templates (top, bottom, left, right), and inside each a trigger on RenderingMode picks the tab items' template, which the item style takes from TabItemControlTemplate. Custom leaves that property to the application: a template set on it locally outranks the trigger. Colours. Every brush property takes its default from a key in TabControlResources through a dynamic resource, so an application or a skin in force redefines the key and every tab control follows; a brush set on the control itself wins over both. The control never adds or removes tabs itself. The add button raises AddNewTabItemClick; a tab's close button, a middle click on its header and Ctrl+F4 on the selected tab raise CloseTabItemClick. The application handles those and changes the items.
Members at a glance
AddNewItemButtonBackground | Gets or sets the add new item button background. |
AddNewItemContentBrush | Gets or sets the add new item content brush. |
AddNewTabItemTooltipText | Gets or sets the add new tab item tooltip text. |
ButtonLeftArrowGeometryPathFillBrush | Gets or sets the button left arrow geometry path fill brush. |
ButtonLeftArrowGeometryPathStrokeBrush | Gets or sets the button left arrow geometry path stroke brush. |
ButtonRightArrowGeometryPathFillBrush | Gets or sets the button right arrow geometry path fill brush. |
ButtonRightArrowGeometryPathStrokeBrush | Gets or sets the button right arrow geometry path stroke brush. |
CloseButtonCrossMarkColorBrush | Gets or sets the close button cross mark color brush. |
CloseButtonStrokeBrush | Gets or sets the close button stroke brush. |
CloseTabTooltipText | Gets or sets the close tab tooltip text. |
IsAddNewTabItemButtonVisible | Gets or sets a value indicating whether the tab strip shows an add-new-tab button after its scroll buttons. |
RenderingMode | Gets or sets the rendering mode. |
ScrollButtonBrush | Gets or sets the scroll button brush. |
ScrollButtonOnMouseOverBrush | Gets or sets the scroll button on mouse over brush. |
TabControlBackground | Gets or sets the tab control background. |
TabItemAccentBrush | Gets or sets the accent brush the modern rendering modes draw the selected tab's highlight with: the pill fill, the underline, the selection bar of side-placed tabs. |
TabItemAccentForeground | Gets or sets the brush for the text of a tab drawn on TabItemAccentBrush, such as the selected tab in Pill mode. |
TabItemBorderBrush | Gets or sets the tab item border brush. |
TabItemBorderOnMouseOverBrush | Gets or sets the tab item border on mouse over brush. |
TabItemCloseButtonFillOnMouseOverBrush | Gets or sets the tab item close button fill on mouse over brush. |
TabItemControlTemplate | Gets or sets the tab item control template. |
TabItemFillOnMouseOverBrush | Gets or sets the tab item fill on mouse over brush. |
TabItemPathBrush | Gets or sets the tab item path brush. |
TabItemSelectedFill | Gets or sets the tab item selected fill. |
TabItemTextForeground | Gets or sets the tab item text foreground. |
TabStripBackground | Gets or sets the brush painted behind the tab headers, including the scroll and add buttons. Null, the default, leaves the strip transparent so the parent shows through; set it when the parent is dark, because unselected tabs in the flat modes draw no fill of their own. |
OnKeyDown | Ctrl+F4 asks for the selected tab to be closed, as it closes a document in Windows applications. |
AddNewTabItemClick | Occurs when the add-new-tab button at the end of the tab strip is clicked. |
AddNewItemButtonBackgroundProperty | The add new item button background property |
AddNewItemContentBrushProperty | The add new item content brush property |
AddNewTabItemClickEvent | Identifies the AddNewTabItemClick routed event. |
AddNewTabItemTooltipTextProperty | The add new tab item tooltip text property |
ButtonLeftArrowGeometryPathFillBrushProperty | The button left arrow geometry path fill brush property |
ButtonLeftArrowGeometryPathStrokeBrushProperty | The button left arrow geometry path stroke brush property |
ButtonRightArrowGeometryPathFillBrushProperty | The button right arrow geometry path fill brush property |
ButtonRightArrowGeometryPathStrokeBrushProperty | The button right arrow geometry path stroke brush property |
CloseButtonCrossMarkColorBrushProperty | The close button cross mark color brush property |
CloseButtonStrokeBrushProperty | The close button stroke brush property |
CloseTabTooltipTextProperty | The close tab tooltip text property |
IsAddNewTabItemButtonVisibleProperty | Identifies the IsAddNewTabItemButtonVisible dependency property. |
RenderingModeProperty | The rendering mode property |
ScrollButtonBrushProperty | The scroll button brush property |
ScrollButtonOnMouseOverBrushProperty | The scroll button on mouse over brush property |
TabControlBackgroundProperty | The tab control background property |
TabItemAccentBrushProperty | Identifies the TabItemAccentBrush dependency property. |
TabItemAccentForegroundProperty | Identifies the TabItemAccentForeground dependency property. |
TabItemBorderBrushProperty | The tab item border brush property |
TabItemBorderOnMouseOverBrushProperty | The tab item border on mouse over brush property |
TabItemCloseButtonFillOnMouseOverBrushProperty | The tab item close button fill on mouse over brush property |
TabItemControlTemplateProperty | The tab item control template property |
TabItemFillOnMouseOverBrushProperty | The tab item fill on mouse over brush property |
TabItemPathBrushProperty | The tab item path brush property |
TabItemSelectedFillProperty | The tab item selected fill property |
TabItemTextForegroundProperty | The tab item text foreground property |
TabStripBackgroundProperty | Identifies the TabStripBackground dependency property. |
Properties
AddNewItemButtonBackground
Gets or sets the add new item button background.
Value. The add new item button background.
AddNewItemContentBrush
Gets or sets the add new item content brush.
Value. The add new item content brush.
AddNewTabItemTooltipText
Gets or sets the add new tab item tooltip text.
Value. The add new tab item tooltip text.
ButtonLeftArrowGeometryPathFillBrush
Gets or sets the button left arrow geometry path fill brush.
Value. The button left arrow geometry path fill brush.
ButtonLeftArrowGeometryPathStrokeBrush
Gets or sets the button left arrow geometry path stroke brush.
Value. The button left arrow geometry path stroke brush.
ButtonRightArrowGeometryPathFillBrush
Gets or sets the button right arrow geometry path fill brush.
Value. The button right arrow geometry path fill brush.
ButtonRightArrowGeometryPathStrokeBrush
Gets or sets the button right arrow geometry path stroke brush.
Value. The button right arrow geometry path stroke brush.
CloseButtonCrossMarkColorBrush
Gets or sets the close button cross mark color brush.
Value. The close button cross mark color brush.
CloseButtonStrokeBrush
Gets or sets the close button stroke brush.
Value. The close button stroke brush.
CloseTabTooltipText
Gets or sets the close tab tooltip text.
Value. The close tab tooltip text.
IsAddNewTabItemButtonVisible
Gets or sets a value indicating whether the tab strip shows an add-new-tab button after its scroll buttons.
Value. true to show the button; the default is false .
AddNewItemButtonBackground and AddNewItemContentBrush, shows AddNewTabItemTooltipText, and raises AddNewTabItemClick.RenderingMode
Gets or sets the rendering mode.
Value. The rendering mode.
ScrollButtonBrush
Gets or sets the scroll button brush.
Value. The scroll button brush.
ScrollButtonOnMouseOverBrush
Gets or sets the scroll button on mouse over brush.
Value. The scroll button on mouse over brush.
TabControlBackground
Gets or sets the tab control background.
Value. The tab control background.
TabItemAccentBrush
Gets or sets the accent brush the modern rendering modes draw the selected tab's highlight with: the pill fill, the underline, the selection bar of side-placed tabs.
TabItemAccentForeground
Gets or sets the brush for the text of a tab drawn on TabItemAccentBrush, such as the selected tab in Pill mode.
TabItemBorderBrush
Gets or sets the tab item border brush.
Value. The tab item border brush.
TabItemBorderOnMouseOverBrush
Gets or sets the tab item border on mouse over brush.
Value. The tab item border on mouse over brush.
TabItemCloseButtonFillOnMouseOverBrush
Gets or sets the tab item close button fill on mouse over brush.
Value. The tab item close button fill on mouse over brush.
TabItemControlTemplate
Gets or sets the tab item control template.
Value. The tab item control template.
TabItemFillOnMouseOverBrush
Gets or sets the tab item fill on mouse over brush.
Value. The tab item fill on mouse over brush.
TabItemPathBrush
Gets or sets the tab item path brush.
Value. The tab item path brush.
TabItemSelectedFill
Gets or sets the tab item selected fill.
Value. The tab item selected fill.
TabItemTextForeground
Gets or sets the tab item text foreground.
Value. The tab item text foreground.
TabStripBackground
Gets or sets the brush painted behind the tab headers, including the scroll and add buttons. Null, the default, leaves the strip transparent so the parent shows through; set it when the parent is dark, because unselected tabs in the flat modes draw no fill of their own.
Methods
OnKeyDown
Ctrl+F4 asks for the selected tab to be closed, as it closes a document in Windows applications.
- e
- The key.
Events
AddNewTabItemClick
Occurs when the add-new-tab button at the end of the tab strip is clicked.
IsAddNewTabItemButtonVisible is true. The control does not add a tab itself: handle this event and add a TabItem to Items, or an item to the bound collection.Fields
AddNewItemButtonBackgroundProperty
The add new item button background property
AddNewItemContentBrushProperty
The add new item content brush property
AddNewTabItemClickEvent
Identifies the AddNewTabItemClick routed event.
AddNewTabItemTooltipTextProperty
The add new tab item tooltip text property
ButtonLeftArrowGeometryPathFillBrushProperty
The button left arrow geometry path fill brush property
ButtonLeftArrowGeometryPathStrokeBrushProperty
The button left arrow geometry path stroke brush property
ButtonRightArrowGeometryPathFillBrushProperty
The button right arrow geometry path fill brush property
ButtonRightArrowGeometryPathStrokeBrushProperty
The button right arrow geometry path stroke brush property
CloseButtonCrossMarkColorBrushProperty
The close button cross mark color brush property
CloseButtonStrokeBrushProperty
The close button stroke brush property
CloseTabTooltipTextProperty
The close tab tooltip text property
IsAddNewTabItemButtonVisibleProperty
Identifies the IsAddNewTabItemButtonVisible dependency property.
RenderingModeProperty
The rendering mode property
ScrollButtonBrushProperty
The scroll button brush property
ScrollButtonOnMouseOverBrushProperty
The scroll button on mouse over brush property
TabControlBackgroundProperty
The tab control background property
TabItemAccentBrushProperty
Identifies the TabItemAccentBrush dependency property.
TabItemAccentForegroundProperty
Identifies the TabItemAccentForeground dependency property.
TabItemBorderBrushProperty
The tab item border brush property
TabItemBorderOnMouseOverBrushProperty
The tab item border on mouse over brush property
TabItemCloseButtonFillOnMouseOverBrushProperty
The tab item close button fill on mouse over brush property
TabItemControlTemplateProperty
The tab item control template property
TabItemFillOnMouseOverBrushProperty
The tab item fill on mouse over brush property
TabItemPathBrushProperty
The tab item path brush property
TabItemSelectedFillProperty
The tab item selected fill property
TabItemTextForegroundProperty
The tab item text foreground property
TabStripBackgroundProperty
Identifies the TabStripBackground dependency property.