# LabelExtensions

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 [Label](/api/wisej.web/content/wisej.web.label.md) class.

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

```csharp
public class LabelExtensions
```

{% endtab %}

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

```visual-basic
Public Class LabelExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) AllowHtml\<TLabel>(label, value)

Sets the AllowHtml property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the AllowHtml property.                                           |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether HTML content is allowed in the label text.                      |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated AllowHtml property.

This method allows you to enable or disable HTML content in the label text.

```csharp

myLabel.AllowHtml(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AllowMarkdown\<TLabel>(label, value)

Sets the AllowMarkdown property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the AllowMarkdown property.                                       |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether Markdown content is allowed in the label text.                  |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated AllowMarkdown property.

This method allows you to enable or disable Markdown content in the label text.

```csharp

myLabel.AllowMarkdown(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AutoEllipsis\<TLabel>(label, value)

Sets the AutoEllipsis property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the AutoEllipsis property.                                        |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether ellipsis characters should be displayed for truncated text.     |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated AutoEllipsis property.

This method allows you to control whether ellipsis characters are shown when the text is truncated.

```csharp

myLabel.AutoEllipsis(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AutoSize\<TLabel>(label, value)

Sets the AutoSize property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                   |
| ---------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md).  |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the AutoSize property.                                             |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether the label should automatically resize itself to fit its content. |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated AutoSize property.

This method allows you to control whether the label should automatically resize itself based on its content.

```csharp

myLabel.AutoSize(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AutoToolTip\<TLabel>(label, value)

Sets the AutoToolTip property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the AutoToolTip property.                                         |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether tooltips should be automatically shown for the label.           |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated AutoToolTip property.

This method allows you to enable or disable automatic tooltips for the label.

```csharp

myLabel.AutoToolTip(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) BorderStyle\<TLabel>(label, borderStyle)

Sets the BorderStyle property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter       | Type                                                                           | Description                                                                                  |
| --------------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel**      |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**       | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the BorderStyle property.                                         |
| **borderStyle** | [BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle.md)            | The [BorderStyle](#borderstyle``1) value to set for the label.                               |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated BorderStyle property.

This method allows you to set the border style for the label.

```csharp

myLabel.BorderStyle(BorderStyle.FixedSingle);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) CharacterChasing\<TLabel>(label, characterCasing)

Sets the CharacterCasing property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter           | Type                                                                           | Description                                                                                                 |
| ------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| **TLabel**          |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md).                |
| **label**           | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the CharacterCasing property.                                                    |
| **characterCasing** | [CharacterCasing](/api/wisej.web/editors/wisej.web.charactercasing.md)         | The [CharacterCasing](/api/wisej.web/editors/wisej.web.charactercasing.md) value to set for the label text. |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated CharacterCasing property.

This method allows you to control the character casing for the text displayed in the label.

```csharp

myLabel.CharacterCasing(CharacterCasing.Upper);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) SelfSize\<TLabel>(label, value)

Sets the SelfSize property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the SelfSize property.                                            |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether the label should automatically adjust its size.                 |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated SelfSize property.

This method allows you to specify whether the label should automatically adjust its size based on its content.

```csharp

myLabel.SelfSize(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) TextAlign\<TLabel>(label, alignment)

Sets the text alignment for the specified [Label](/api/wisej.web/content/wisej.web.label.md) control.

| Parameter     | Type                                                                                      | Description                                                                                                                                                      |
| ------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **TLabel**    |                                                                                           | The type of the label, which must inherit from [Label](/api/wisej.web/content/wisej.web.label.md).                                                               |
| **label**     | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md)            | The label for which to set the text alignment.                                                                                                                   |
| **alignment** | [ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment) | The alignment to be applied to the label's text, specified as a [ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment) value. |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The label with the updated text alignment.

This method allows you to specify how the text is aligned within the label's bounds.

```csharp

myLabel.TextAlign(ContentAlignment.MiddleCenter);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) UseMnemonic\<TLabel>(label, value)

Sets the UseMnemonic property of the specified [Label](/api/wisej.web/content/wisej.web.label.md).

| Parameter  | Type                                                                           | Description                                                                                  |
| ---------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| **TLabel** |                                                                                | The type of the label, must inherit from [Label](/api/wisej.web/content/wisej.web.label.md). |
| **label**  | [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md) | The label for which to set the UseMnemonic property.                                         |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean indicating whether mnemonic characters are used in the label text.                 |

**Returns:** [TLabel](/api/wisej.web.markup/extensions/wisej.web.markup.labelextensions.md). The modified label with the updated UseMnemonic property.

This method allows you to enable or disable the use of mnemonic characters in the label text.

```csharp

myLabel.UseMnemonic(true);

```


---

# 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.labelextensions.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.
