WebMap for Blazor
  • WebMap Blazor
    • Modernization
      • Overview
      • Modernization Challenges
      • Our solution
      • What is Blazor?
      • How does Blazor Work?
      • Windows Forms in Blazor
      • Deployment
      • Interfacing with hardware devices
    • Research for Blazor
      • Handling Reference Parameters in Async Methods with Ref<T>
      • Alternatives to Async Properties in C#
      • Issue with using "MessageBox.Show" in Blazor
      • File Upload Functionality
      • Async/Await Feature for WebMap Blazor
    • Assessment Tool
    • Conversion Tool
      • Getting Started
      • Modals and Dialogs
      • Static Service Management
      • ImageListStreamer
      • Solution and Project Structure
        • Solution Generator
    • DCP: Desktop Compatibility Library
      • API Documentation
        • Blazor DCP: Gap.Blazor.Application Class Reference
      • Components Information
        • Button Component
        • Application Data Component
        • GroupBox Component
        • Label Component
        • CheckBox
        • CheckedListBox
        • ComboBox
        • DateTimePicker
        • Form
        • ListBox
        • ListView
          • WMListViewDetails
        • Mdi Container Component
        • MenuStrip
        • MessageBox
        • MonthCalendar
        • Panel
        • PictureBox
        • ProgressBar
        • RadioButton
        • StatusStrip
        • ToolStripStatusLabel
        • TabControl
        • TabPage
        • TextBox
        • ToolStrip
          • ToolStripButton
          • ToolStripLabel
          • ToolStripSeparator
        • ToolTip
    • Post Conversion
      • How To?
        • Create a new WebMap Window?
        • Create a new WebMap Component?
        • Create a native Blazor Window in a WebMap app?
        • Create a native Blazor Component in a WebMap Window?
        • Change the default WebMap visual layout?
    • WebMap: Angular vs Blazor
      • Footprint
      • Binaries size
      • Chatiness
      • Performance
      • Extensibility
      • Maintainability
      • Debugging
      • Project Structure
    • WebMap for Blazor Release Notes
      • Beta version
    • FAQ
    • Errors and Troubleshooting
    • License
Powered by GitBook
On this page
  • Description
  • Usage
  • Properties
  • Methods
  • Dynamic Rendering
  • Styles
  • Events
Export as PDF
  1. WebMap Blazor
  2. DCP: Desktop Compatibility Library
  3. Components Information

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

@if (this.Visible)
{
    <div class="@(this.TabControl.GetStringClasses())">
        <WMStyleBase model=@this.TabControl></WMStyleBase>

        <TelerikTabStrip Class="@(this.GetAppearanceStringClass())"
                         Height="100%"
                         ActiveTabIndex="this.GetActiveTabIndex()"
                         ActiveTabIndexChanged="TabChangedHandler"
                         TabPosition="(TabPosition)this.TabControl.Alignment"
                         Scrollable="!this.TabControl.Multiline"
                         TabAlignment="this.GetTabAlignmentFromSizeMode()">
            @ChildContent
        </TelerikTabStrip>

        <style>
            .@(this.TabControl.GetComponentClass()) .k-item {
                font-size: @this.TabControl.Font.GetFontSize();
                font-weight: @this.TabControl.Font.GetFontWeight();
                font-style: @this.TabControl.Font.GetFontStyle();
                font-family: @this.TabControl.Font.GetFontFamily();
                text-decoration: @this.TabControl.Font.GetTextDecoration();
            }

            .@(this.TabControl.GetComponentClass()) .k-item {
                height: @this.GetItemSizeHeight();
                width: @this.GetItemSizeWith();
            }

            .@(this.TabControl.GetComponentClass()) .k-tabstrip-items-wrapper > .k-button {
                height: @this.GetItemSizeHeight();
            }
        </style>
    </div>
}

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’s TabStripTabAlignment.

  • 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() and GetPageIndex().

Styles

.@model.GetComponentClass() .k-item {
    font-size: [from model];
    font-weight: [from model];
    font-style: [from model];
    font-family: [from model];
    text-decoration: [from model];
    height: [calculated];
    width: [calculated];
}

.@model.GetComponentClass() .k-tabstrip-items-wrapper > .k-button {
    height: [calculated];
}

Events

  • AlignmentChanged

  • AppearanceChanged

  • ItemSizeChanged

  • MultilineChanged

  • SizeModeChanged

  • SelectedIndexChanged

  • Controls Collection Events: AfterAdd, AfterRemove, AfterClear, AfterInsert

PreviousToolStripStatusLabelNextTabPage

Last updated 2 days ago