TabControl class Core
Pages behind a strip of tabs: one page is shown, the tabs pick which. A click or the arrows on the strip pick a tab and show its page at once; Home and End go to the first and the last tab; Ctrl+Tab and Ctrl+Shift+Tab (or Ctrl+Page Down/Up) step through the pages from anywhere inside the control. The strip is one tab stop - the selected tab - and Tab goes from it into the page. Tabs that can close show a close mark; a click on it, Delete or Ctrl+F4 on the focused tab close the page (TabControl.Closing may refuse).
For assistive technology the control is a tab list, named by Control.AccessibleName, holding its tabs ("General, 1 of 3"), each selected while its page shows, and the shown page: a tab panel named after its tab, holding the parts of its controls. The pages not shown are hidden: they are no tab stops, no parts, and controls on them are detached (Control.OnDetached).
Styling. The tabs from Select.Type<TabItem>(): background, text colour, size and family, corner radius, the accent colour of the selected tab's bar and the focus ring, in every state - the selected tab in TileStates.Checked. The line under the strip from Select.Type<TabControl>(): its border colour and width.
Change TabControl.SelectedIndex, add and remove pages on a shown board inside Board.Mutate.
public sealed class TabControl : Control
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Control
Constructors
TabControl
public TabControl();An empty tab control; add its pages with TabControl.Add.
Properties
Children
public override IEnumerable<Control> Children { get; }The controls inside this one, in tree order (visual order, tab order). A host keeps the tree it adopted: a control whose children change once it is adopted says so with Control.TreeChanged (on a shown board inside Board.Mutate), or its new children get no host and Tab, ticks and the wheel do not find them.
ClosableTabs
public bool ClosableTabs { get; init; }Every tab shows a close mark, unless its page says otherwise.
Closing
public Func<int, bool>? Closing { get; init; }Asked before a page closes, with its index; false keeps it. Null closes it.
PagePadding
public double PagePadding { get; init; }Space between the line under the strip and the page, and around the page.
Pages
public IReadOnlyList<TabPage> Pages { get; }The pages, in the order of their tabs.
Role
public override ControlRole Role { get; }For assistive technology the control is the tab list: its tabs and the shown page are its parts, named by Control.AccessibleName.
SelectedIndex
public int SelectedIndex { get; set; }The index of the page shown; -1 while there is none. Setting it shows that page.
SelectionChanged
public Action<int>? SelectionChanged { get; init; }A page was picked (a click, a key, assistive technology, or in code), with its index.
StripHeight
public double StripHeight { get; init; }The height of the strip.
Tabs
public IReadOnlyList<TabItem> Tabs { get; }The tabs, in order - the parts the strip holds.
Methods
Add
public TabControl Add(TabPage page);Adds a page behind a new tab.
Add
public TabControl Add(Func<string> header, Control content, bool? canClose = default, string id = "");Adds a page captioned header.
Arrange
public override void Arrange(LogRect bounds);
Close
public bool Close(int index);Closes the page at index as the user does: asks TabControl.Closing first. False when it stays.
HitTest
public override Control? HitTest(LogPoint p);The control under an ABSOLUTE point, or null. Containers recurse; leaves answer for themselves. Same bounds the render pass used.
Measure
public override LogSize Measure(LogSize available);As tall as the tallest page, so picking another page does not move what follows.
RemoveAt
public void RemoveAt(int index);Removes the page at index without asking TabControl.Closing. The page after it is shown when it was the shown one.
Render
public override void Render(IRenderSurface s, ControlFrame frame);