TabControlExtensions

Wisej.Web.Markup.TabControlExtensions

Namespace: Wisej.Web.Markup

Assembly: Wisej.Framework (4.0.0.0)

Adds fluent markup extension methods to the TabControl class.

public class TabControlExtensions

Methods

Alignment<TTabControl>(tabControl, alignment)

Sets the Alignment property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the Alignment property.

alignment

The TabAlignment to set for the tab control.

Returns: TTabControl. The modified tab control with the updated Alignment property.

This method allows you to specify the alignment of the tabs in the tab control.


myTabControl.Alignment(TabAlignment.Bottom);

BorderStyle<TTabControl>(tabControl, borderStyle)

Sets the BorderStyle property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the BorderStyle property.

borderStyle

The BorderStyle to set for the tab control.

Returns: TTabControl. The modified tab control with the updated BorderStyle property.

This method allows you to specify the border style of the tab control.


myTabControl.BorderStyle(BorderStyle.FixedSingle);

ItemSize<TTabControl>(tabControl, size)

Sets the ItemSize property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the ItemSize property.

size

The Size to set for each tab item.

Returns: TTabControl. The modified tab control with the updated ItemSize property.

This method allows you to specify the size of each tab item in the tab control.


myTabControl.ItemSize(new Size(100, 50));

OnDeselected<TTabControl>(tabControl, action)

Attaches an event handler for the Deselected event of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control to attach the event handler to.

action

An action to execute when a tab is deselected.

Returns: TTabControl. The modified tab control with the attached Deselected event handler.

This method allows you to execute a custom action whenever a tab is deselected.


myTabControl.OnDeselected((tc, args) =>
{
AlertBox.Show("Tab deselected!");
});

OnDeselecting<TTabControl>(tabControl, action)

Attaches an event handler for the Deselecting event of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control to attach the event handler to.

action

An action to execute when a tab is being deselected.

Returns: TTabControl. The modified tab control with the attached Deselecting event handler.

This method allows you to execute a custom action whenever a tab is being deselected.


myTabControl.OnDeselecting((tc, args) =>
{
AlertBox.Show("Tab deselecting!");
});

OnSelected<TTabControl>(tabControl, action)

Attaches an event handler for the Selected event of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control to attach the event handler to.

action

An action to execute when a tab is selected.

Returns: TTabControl. The modified tab control with the attached Selected event handler.

This method allows you to execute a custom action whenever a tab is selected.


myTabControl.OnSelected((tc, args) =>
{
AlertBox.Show("Tab selected!");
});

OnSelecting<TTabControl>(tabControl, action)

Attaches an event handler for the Selecting event of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control to attach the event handler to.

action

An action to execute when a tab is being selected.

Returns: TTabControl. The modified tab control with the attached Selecting event handler.

This method allows you to execute a custom action whenever a tab is being selected.


myTabControl.OnSelecting((tc, args) =>
{
AlertBox.Show("Tab selecting!");
});

SelectedIndex<TTabControl>(tabControl, value)

Sets the SelectedIndex property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the SelectedIndex property.

value

The index of the tab to select.

Returns: TTabControl. The modified tab control with the updated SelectedIndex property.

This method allows you to specify the index of the tab to select.


myTabControl.SelectedIndex(1);

ShowToolTips<TTabControl>(tabControl, value)

Sets the ShowToolTips property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the ShowToolTips property.

value

A boolean indicating whether tooltips are shown for the tabs.

Returns: TTabControl. The modified tab control with the updated ShowToolTips property.

This method allows you to enable or disable the display of tooltips for the tabs in the tab control.


myTabControl.ShowToolTips(true);

SizeMode<TTabControl>(tabControl, sizeMode)

Sets the SizeMode property of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control for which to set the SizeMode property.

sizeMode

The TabSizeMode to set for the tab control.

Returns: TTabControl. The modified tab control with the updated SizeMode property.

This method allows you to specify the size mode of the tabs in the tab control.


myTabControl.SizeMode(TabSizeMode.Fixed);

TabPages<TTabControl>(tabControl, tabPages)

Adds the specified tab pages to the TabPages collection of the specified TabControl.

Parameter
Type
Description

TTabControl

The type of the tab control, must inherit from TabControl.

tabControl

The tab control to which the tab pages should be added.

tabPages

An array of TabPage to add to the tab control.

Returns: TTabControl. The modified tab control with the added tab pages.

This method allows you to add multiple tab pages to the tab control in one call.


myTabControl.TabPages(new TabPage("Tab1"), new TabPage("Tab2"));

Last updated

Was this helpful?