# TabControlExtensions

URL: https://docs.wisej.com/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions

Version: 4.1
Namespace: **Wisej.Web.Markup**

Assembly: **Wisej.Framework** (4.1.0.0)

Adds [fluent markup](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup) extension methods to theTabControl class.

- C# - VB.NET

```csharp
public class TabControlExtensions
```

```visual
Public Class TabControlExtensions
```

## Methods

### ![Static member](/img/api/static.png) Alignment<TTabControl>(tabControl, alignment)

Sets the Alignment property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the Alignment property. | **alignment** | [TabAlignment](/api/wisej.web/containers/tabcontrol/wisej.web.tabalignment) | The [TabAlignment](/api/wisej.web/containers/tabcontrol/wisej.web.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.

```csharp
myTabControl.Alignment(TabAlignment.Bottom);
```

### ![Static member](/img/api/static.png) BorderStyle<TTabControl>(tabControl, borderStyle)

Sets the BorderStyle property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the BorderStyle property. | **borderStyle** | [BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle) | The [BorderStyle](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions) 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.

```csharp
myTabControl.BorderStyle(BorderStyle.FixedSingle);
```

### ![Static member](/img/api/static.png) ItemSize<TTabControl>(tabControl, size)

Sets the ItemSize property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the ItemSize property. | **size** | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size) | The [Size](https://docs.microsoft.com/dotnet/api/system.drawing.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.

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

### ![Static member](/img/api/static.png) OnDeselected<TTabControl>(tabControl, action)

Attaches an event handler for the Deselected event of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control to attach the event handler to. | **action** | [Action<TTabControl, TabControlEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | 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.

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

### ![Static member](/img/api/static.png) OnDeselecting<TTabControl>(tabControl, action)

Attaches an event handler for the Deselecting event of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control to attach the event handler to. | **action** | [Action<TTabControl, TabControlCancelEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | 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.

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

### ![Static member](/img/api/static.png) OnSelected<TTabControl>(tabControl, action)

Attaches an event handler for the Selected event of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control to attach the event handler to. | **action** | [Action<TTabControl, TabControlEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | 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.

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

### ![Static member](/img/api/static.png) OnSelecting<TTabControl>(tabControl, action)

Attaches an event handler for the Selecting event of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control to attach the event handler to. | **action** | [Action<TTabControl, TabControlCancelEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | 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.

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

### ![Static member](/img/api/static.png) SelectedIndex<TTabControl>(tabControl, value)

Sets the SelectedIndex property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the SelectedIndex property. | **value** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | 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.

```csharp
myTabControl.SelectedIndex(1);
```

### ![Static member](/img/api/static.png) ShowToolTips<TTabControl>(tabControl, value)

Sets the ShowToolTips property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the ShowToolTips property. | **value** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | 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.

```csharp
myTabControl.ShowToolTips(true);
```

### ![Static member](/img/api/static.png) SizeMode<TTabControl>(tabControl, sizeMode)

Sets the SizeMode property of the specifiedTabControl .

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control for which to set the SizeMode property. | **sizeMode** | [TabSizeMode](/api/wisej.web/containers/tabcontrol/wisej.web.tabsizemode) | The [TabSizeMode](/api/wisej.web/containers/tabcontrol/wisej.web.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.

```csharp
myTabControl.SizeMode(TabSizeMode.Fixed);
```

### ![Static member](/img/api/static.png) TabPages<TTabControl>(tabControl, tabPages)

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

| Parameter | Type | Description | **TTabControl** | | The type of the tab control, must inherit fromTabControl . | **tabControl** | TTabControl | The tab control to which the tab pages should be added. | **tabPages** | [TabPage[]](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage) | An array of [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.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.

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