# RadioButtonExtensions

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 [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) class.

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

```csharp
public class RadioButtonExtensions
```

{% endtab %}

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

```visual-basic
Public Class RadioButtonExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) Appearance\<TRadioButton>(radioButton, appearance)

Sets the Appearance property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md). |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the Appearance property.                                                      |
| **appearance**   | [Appearance](/api/wisej.web/enumerations/wisej.web.appearance.md)                          | The [Appearance](#appearance``1) to set for the radio button.                                                   |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated Appearance property.

This method allows you to specify the appearance of the radio button.

```csharp

myRadioButton.Appearance(Appearance.Button);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AutoCheck\<TRadioButton>(radioButton, value)

Sets the AutoCheck property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md). |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the AutoCheck property.                                                       |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether the radio button is automatically checked when clicked.                            |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated AutoCheck property.

This method allows you to enable or disable automatic checking of the radio button when it is clicked.

```csharp

myRadioButton.AutoCheck(false);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) AutoToolTip\<TRadioButton>(radioButton, value)

Sets the AutoToolTip property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                                      |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) and have an AutoToolTip property. |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the AutoToolTip property.                                                                                      |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether tooltips are automatically shown for the radio button.                                                              |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated AutoToolTip property.

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

```csharp

myRadioButton.AutoToolTip(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) CheckAlign\<TRadioButton>(radioButton, value)

Sets the CheckAlign property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).                    |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the CheckAlign property.                                                                         |
| **value**        | [ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment)  | The [ContentAlignment](https://docs.microsoft.com/dotnet/api/system.drawing.contentalignment) to set for the check mark alignment. |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated CheckAlign property.

This method allows you to specify the alignment of the check mark within the radio button.

```csharp

myRadioButton.CheckAlign(ContentAlignment.MiddleRight);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Checked\<TRadioButton>(radioButton, value)

Sets the Checked property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md). |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the Checked property.                                                         |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether the radio button is checked.                                                       |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated Checked property.

This method allows you to specify whether the radio button is checked.

```csharp

myRadioButton.Checked(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) CheckedForeColor\<TRadioButton>(radioButton, color)

Sets the CheckedForeColor property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                                          |
| ---------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) and have a CheckedForeColor property. |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the CheckedForeColor property.                                                                                     |
| **color**        | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color)                        | The [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) to set for the checked state text color.                                     |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated CheckedForeColor property.

This method allows you to specify the text color when the radio button is checked.

```csharp

myRadioButton.CheckedForeColor(Color.Red);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Invalid\<TRadioButton>(radioButton, value)

Sets the Invalid property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                                  |
| ---------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) and have an Invalid property. |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the Invalid property.                                                                                      |
| **value**        | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                            | A boolean indicating whether the radio button is in an invalid state.                                                                        |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated Invalid property.

This method allows you to specify whether the radio button is in an invalid state.

```csharp

myRadioButton.Invalid(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) InvalidMessage\<TRadioButton>(radioButton, message)

Sets the InvalidMessage property of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                                         |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) and have an InvalidMessage property. |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button for which to set the InvalidMessage property.                                                                                      |
| **message**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                              | The message to set for the invalid state.                                                                                                           |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the updated InvalidMessage property.

This method allows you to specify a custom message to display when the radio button is in an invalid state.

```csharp

myRadioButton.InvalidMessage("This option is not valid.");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnAppearanceChanged\<TRadioButton>(radioButton, action)

Attaches an event handler for the AppearanceChanged event of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md). |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button to attach the event handler to.                                                                |
| **action**       | [Action\<TRadioButton>](https://docs.microsoft.com/dotnet/api/system.action-1)             | An action to execute when the appearance changes.                                                               |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the attached AppearanceChanged event handler.

This method allows you to execute a custom action whenever the appearance of the radio button changes.

```csharp

myRadioButton.OnAppearanceChanged(rb =>
{
AlertBox.Show("Appearance changed!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnCheckedChanged\<TRadioButton>(radioButton, action)

Attaches an event handler for the CheckedChanged event of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                     |
| ---------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md). |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button to attach the event handler to.                                                                |
| **action**       | [Action\<TRadioButton>](https://docs.microsoft.com/dotnet/api/system.action-1)             | An action to execute when the checked state changes.                                                            |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the attached CheckedChanged event handler.

This method allows you to execute a custom action whenever the checked state of the radio button changes.

```csharp

myRadioButton.OnCheckedChanged(rb =>
{
AlertBox.Show("Checked state changed!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnReadOnlyChanged\<TRadioButton>(radioButton, action)

Attaches an event handler for the ReadOnlyChanged event of the specified [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md).

| Parameter        | Type                                                                                       | Description                                                                                                                                      |
| ---------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **TRadioButton** |                                                                                            | The type of the radio button, must inherit from [RadioButton](/api/wisej.web/buttons/wisej.web.radiobutton.md) and have a ReadOnlyChanged event. |
| **radioButton**  | [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md) | The radio button to attach the event handler to.                                                                                                 |
| **action**       | [Action\<TRadioButton>](https://docs.microsoft.com/dotnet/api/system.action-1)             | An action to execute when the read-only state changes.                                                                                           |

**Returns:** [TRadioButton](/api/wisej.web.markup/extensions/wisej.web.markup.radiobuttonextensions.md). The modified radio button with the attached ReadOnlyChanged event handler.

This method allows you to execute a custom action whenever the read-only state of the radio button changes.

```csharp

myRadioButton.OnReadOnlyChanged(rb =>
{
AlertBox.Show("Read-only state changed!");
});

```


---

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