Class TabControl
Represents a control that manages a related set of tab pages.
[ControlCategory("Containers")]
public class TabControl : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
- Inheritance
-
TabControl
- Implements
- Derived
Examples
Here is how to declare a TabControl in UIXML:
<TabControl SuggestedHeight="150" Name="tabControl" Margin="8">
<TabPage Title="Page 1"></TabPage>
<TabPage Title="Page 2"></TabPage>
<TabPage Title="Page 3"></TabPage>
<TabPage Title="Page 4"></TabPage>
<TabPage Title="Page 5"></TabPage>
</TabControl>
Also, a TabControl can be created from code:
var tc = new Alternet.UI.TabControl();
tc.SuggestedSize = (250, 300);
tc.Pages.Add(new TabPage { Title = "Page 1"});
tc.Pages.Add(new TabPage { Title = "Page 2" });
tc.Pages.Add(new TabPage { Title = "Page 3" });
tc.Pages.Add(new TabPage { Title = "Page 4" });
tc.Pages.Add(new TabPage { Title = "Page 5" });
tc.Parent = mainPanel;
Remarks
Examples of how a TabControl can look on different platforms:
Constructors
- TabControl()
Initializes a new instance of the TabControl class.
Fields
- DefaultMinTabSize
Gets or sets default minimal tab size in the header.
Properties
- Appearance
Gets or sets the visual appearance of the control's tabs.
- ContentPadding
Gets or sets padding of contents.
- ControlKind
Returns control identifier.
- DisplayRectangle
Gets the display area of the control's tab pages.
- HasInteriorBorder
Gets or sets whether tab interior border is visible.
- IsVertical
Gets or sets how the tabs and content are aligned.
- Padding
Gets or sets the padding inside a control.
- Pages
Gets the collection of tab pages in this tab control.
- SelectedControl
Gets selected tab page.
- SelectedIndex
Gets or sets the index of the currently selected tab page.
- SelectedPage
Gets or sets the currently selected tab page.
- SizeMode
Gets or sets the way that the control's tabs are sized.
- TabAlignment
Gets or sets the area of the control (for example, along the top) where the tabs are aligned.
- TabCount
Gets the number of tabs in the tab strip.
- TabTheme
Gets or sets colors and styles theme of the tabs.
- TabsVisible
Gets or sets whether tab titles are visible.
Methods
- Add(Control)
Adds new page.
- Add(NameValue<Control>)
Adds new page.
- Add(NameValue<Func<Control>>)
Adds new page.
- Add(string, Control?)
Adds new page.
- Add(string, Func<Control>)
Adds new page.
- AddRange(IEnumerable<NameValue<Control>>)
Adds new pages.
- AddRange(IEnumerable<NameValue<Func<Control>>?>)
Adds new pages.
- GetControlAt(int?)
Gets tab page at the specified index.
- GetDefaultInteriorBorderColor()
Gets default interior border color as LightDarkColor.
- GetInteriorBorderColor()
Gets interior border color.
- GetTabIndex(Control?)
Gets index of the tab page or
null
if control is not found in tabs.
- GetTitle(int?)
Gets title of the specified tab page.
- Insert(int?, Control)
Inserts new page at the specified index.
- Insert(int?, string, Control?)
Inserts new page at the specified index.
- OnChildPropertyChanged(Control, string, bool)
Called by the child control when its property is changed.
- OnPaint(PaintEventArgs)
Called when the control is redrawn. See Paint for details.
- OnSizeChanged(EventArgs)
Called when the SizeChanged event.
- Remove(Control)
Removes tab page from the control.
- RemoveAll()
Removed all items from the control.
- RemoveAt(int?)
Removes tab page with the specified index.
- SelectFirstTab()
Selects the first tab if it exists.
- SelectTab(int?)
Selects tab with the specified index.
- SetTabImage(int?, Image?, Image?)
Sets images for the tab.
- SetTabImage(int?, ImageSet?, ImageSet?)
Sets images for the tab.
- SetTitle(int?, string?)
Sets title of the specified tab page.
Events
- SelectedIndexChanged
Occurs when the SelectedIndex property has changed.
- SelectedPageChanged
Occurs when the selected page has changed.
- TabSizeChanged
Occurs when the size of the tab has changed.