# TabControlExtensions

Namespace: **Wisej.Web.Markup**

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

Adds [fluent markup](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup) extension methods to the [TabControl](/api/wisej.web/containers/tabcontrol.md) class.

{% tabs %}
{% tab title="C#" %}

```csharp
public class TabControlExtensions
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class TabControlExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) Alignment\<TTabControl>(tabControl, alignment)

Sets the Alignment property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                                    |
| --------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md).          |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | The tab control for which to set the Alignment property.                                                       |
| **alignment**   | [TabAlignment](/api/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md)           | The [TabAlignment](/api/wisej.web/containers/tabcontrol/wisej.web.tabalignment.md) to set for the tab control. |

**Returns:** [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) BorderStyle\<TTabControl>(tabControl, borderStyle)

Sets the BorderStyle property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                           |
| --------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | The tab control for which to set the BorderStyle property.                                            |
| **borderStyle** | [BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle.md)                      | The [BorderStyle](#borderstyle``1) to set for the tab control.                                        |

**Returns:** [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ItemSize\<TTabControl>(tabControl, size)

Sets the ItemSize property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                           |
| --------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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));

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnDeselected\<TTabControl>(tabControl, action)

Attaches an event handler for the Deselected event of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                               | Description                                                                                           |
| --------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                                    | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md)           | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnDeselecting\<TTabControl>(tabControl, action)

Attaches an event handler for the Deselecting event of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                                     | Description                                                                                           |
| --------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md)                 | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnSelected\<TTabControl>(tabControl, action)

Attaches an event handler for the Selected event of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                               | Description                                                                                           |
| --------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                                    | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md)           | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnSelecting\<TTabControl>(tabControl, action)

Attaches an event handler for the Selecting event of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                                     | Description                                                                                           |
| --------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md)                 | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) SelectedIndex\<TTabControl>(tabControl, value)

Sets the SelectedIndex property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                           |
| --------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ShowToolTips\<TTabControl>(tabControl, value)

Sets the ShowToolTips property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                           |
| --------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md). |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | 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](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) SizeMode\<TTabControl>(tabControl, sizeMode)

Sets the SizeMode property of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                                  |
| --------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md).        |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | The tab control for which to set the SizeMode property.                                                      |
| **sizeMode**    | [TabSizeMode](/api/wisej.web/containers/tabcontrol/wisej.web.tabsizemode.md)             | The [TabSizeMode](/api/wisej.web/containers/tabcontrol/wisej.web.tabsizemode.md) to set for the tab control. |

**Returns:** [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) TabPages\<TTabControl>(tabControl, tabPages)

Adds the specified tab pages to the TabPages collection of the specified [TabControl](/api/wisej.web/containers/tabcontrol.md).

| Parameter       | Type                                                                                     | Description                                                                                                 |
| --------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **TTabControl** |                                                                                          | The type of the tab control, must inherit from [TabControl](/api/wisej.web/containers/tabcontrol.md).       |
| **tabControl**  | [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md) | The tab control to which the tab pages should be added.                                                     |
| **tabPages**    | [TabPage\[\]](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md)                 | An array of [TabPage](/api/wisej.web/containers/tabcontrol/wisej.web.tabpage.md) to add to the tab control. |

**Returns:** [TTabControl](/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md). 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"));

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web.markup/extensions/wisej.web.markup.tabcontrolextensions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
