TabControl
Description
This component represents a tabbed interface in Blazor using the Gap.Blazor.TabControl
model. It uses the Telerik TabStrip
component to render tab pages with customizable alignment, appearance, size mode, and visibility logic. It supports dynamic tab switching and layout updates based on model changes.
Usage
Properties
TabControl: Instance of the
Gap.Blazor.TabControl
model.ChildContent: The tab pages to be rendered inside the tab strip.
Alignment: Determines the position of the tabs (Top, Bottom, Left, Right).
Appearance: Controls the visual style of the tabs (Normal, Buttons, FlatButtons).
SizeMode: Controls how tab sizes are calculated (Fixed, FillToRight).
Multiline: If
false
, enables horizontal scrolling for tabs.
Methods
OnInitialized(): Subscribes to model events for alignment, appearance, size, multiline, and tab collection changes.
GetAppearanceStringClass(): Returns a CSS class based on the
Appearance
setting.GetItemSizeHeight() / GetItemSizeWith(): Calculates tab dimensions based on alignment and size mode.
GetTabAlignmentFromSizeMode(): Maps
SizeMode
to Telerik’sTabStripTabAlignment
.TabChangedHandler(int): Updates the selected tab index, accounting for hidden tabs.
GetActiveTabIndex(): Returns the index of the currently selected tab, adjusted for visibility.
Dynamic Rendering
TelerikTabStrip: Renders the tab interface with dynamic alignment, appearance, and scroll behavior.
CSS Styling: Font and size styles are applied per tab item based on the model.
Visibility Logic: Adjusts tab index to account for hidden tabs using
VisibleAffected()
andGetPageIndex()
.
Styles
Events
AlignmentChanged
AppearanceChanged
ItemSizeChanged
MultilineChanged
SizeModeChanged
SelectedIndexChanged
Controls Collection Events:
AfterAdd
,AfterRemove
,AfterClear
,AfterInsert
Last updated