# CheckedListBoxExtensions

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 [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md) class.

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

```csharp
public class CheckedListBoxExtensions
```

{% endtab %}

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

```visual-basic
Public Class CheckedListBoxExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) CheckOnClick\<TListBox>(listBox, value)

Sets the CheckOnClick property of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter    | Type                                                                                      | Description                                                                                                             |
| ------------ | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox** |                                                                                           | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**  | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md) | The checked list box for which to set the CheckOnClick property.                                                        |
| **value**    | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                           | A boolean indicating whether items are checked on click.                                                                |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the updated CheckOnClick property.

This method allows you to specify whether items in the list box are checked or unchecked when clicked.

```csharp

myCheckedListBox.CheckOnClick(true);

```

### ![](/files/lIX317sDtMTZJBi9oSIx) CheckStateMember\<TListBox>(listBox, checkStateMember)

Sets the CheckStateMember property of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter            | Type                                                                                      | Description                                                                                                             |
| -------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox**         |                                                                                           | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**          | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md) | The checked list box for which to set the CheckStateMember property.                                                    |
| **checkStateMember** | [String](https://docs.microsoft.com/dotnet/api/system.string)                             | The property to use as the check state for the list items.                                                              |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the updated CheckStateMember property.

This method allows you to set the property to use as the check state for the list items.

```csharp

myCheckedListBox.CheckStateMember("IsChecked");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnAfterItemCheck\<TListBox>(listBox, action)

Attaches an event handler for the AfterItemCheck event of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter    | Type                                                                                           | Description                                                                                                             |
| ------------ | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox** |                                                                                                | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**  | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md)      | The checked list box to attach the event handler to.                                                                    |
| **action**   | [Action\<TListBox, ItemCheckEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An action to execute after an item's checked state changes.                                                             |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the attached AfterItemCheck event handler.

This method allows you to execute a custom action after an item's checked state changes in the list box.

```csharp

myCheckedListBox.OnAfterItemCheck((lb, args) =>
{
AlertBox.Show("Item check state changed post-event!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnCheckStateMemberChanged\<TListBox>(listBox, action)

Attaches an event handler for the CheckStateMemberChanged event of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter    | Type                                                                                      | Description                                                                                                             |
| ------------ | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox** |                                                                                           | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**  | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md) | The checked list box to attach the event handler to.                                                                    |
| **action**   | [Action\<TListBox>](https://docs.microsoft.com/dotnet/api/system.action-1)                | An action to execute when the CheckStateMember property changes.                                                        |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the attached CheckStateMemberChanged event handler.

This method allows you to execute a custom action whenever the CheckStateMember property changes in the list box.

```csharp

myCheckedListBox.OnCheckStateMemberChanged(lb =>
{
AlertBox.Show("CheckStateMember property changed!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnItemCheck\<TListBox>(listBox, action)

Attaches an event handler for the ItemCheck event of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter    | Type                                                                                           | Description                                                                                                             |
| ------------ | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox** |                                                                                                | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**  | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md)      | The checked list box to attach the event handler to.                                                                    |
| **action**   | [Action\<TListBox, ItemCheckEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An action to execute when an item's checked state changes.                                                              |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the attached ItemCheck event handler.

This method allows you to execute a custom action whenever an item's checked state changes in the list box.

```csharp

myCheckedListBox.OnItemCheck((lb, args) =>
{
AlertBox.Show("Item check state changed!");
});

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Separator\<TListBox>(listBox, separator)

Sets the Separator property of the specified [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md).

| Parameter     | Type                                                                                      | Description                                                                                                             |
| ------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **TListBox**  |                                                                                           | The type of the checked list box, must inherit from [CheckedListBox](/api/wisej.web/lists-and-grids/checkedlistbox.md). |
| **listBox**   | [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md) | The checked list box for which to set the Separator property.                                                           |
| **separator** | [String](https://docs.microsoft.com/dotnet/api/system.string)                             | The string to use as a separator for the list items.                                                                    |

**Returns:** [TListBox](/api/wisej.web.markup/extensions/wisej.web.markup.checkedlistboxextensions.md). The modified checked list box with the updated Separator property.

This method allows you to set a custom separator for the list items.

```csharp

myCheckedListBox.Separator(", ");

```


---

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