# PanelExtensions

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 [Panel](/api/wisej.web/containers/wisej.web.panel.md) class.

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

```csharp
public class PanelExtensions
```

{% endtab %}

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

```visual-basic
Public Class PanelExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) Collapsed\<TPanel>(panel, value)

Sets the collapsed state of the panel.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean value indicating whether the panel should be collapsed.                                     |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated collapsed state.

### ![](/files/lIX317sDtMTZJBi9oSIx) CollapseSide\<TPanel>(panel, value)

Sets the side of the panel to collapse.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **value**  | [HeaderPosition](/api/wisej.web/enumerations/wisej.web.headerposition.md)      | The [HeaderPosition](#headerposition``1) indicating which side of the panel to collapse.              |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated collapse side.

### ![](/files/lIX317sDtMTZJBi9oSIx) HeaderAlignment\<TPanel>(panel, value)

Sets the alignment of the panel's header.

| Parameter  | Type                                                                                | Description                                                                                                                     |
| ---------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                     | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md).                           |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md)      | The panel to modify.                                                                                                            |
| **value**  | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | The [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) indicating the alignment of the header. |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header alignment.

### ![](/files/lIX317sDtMTZJBi9oSIx) HeaderBackColor\<TPanel>(panel, value)

Sets the background color of the panel's header.

| Parameter  | Type                                                                           | Description                                                                                                              |
| ---------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md).                    |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                                     |
| **value**  | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color)            | The [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) representing the background color of the header. |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header background color.

### ![](/files/lIX317sDtMTZJBi9oSIx) HeaderForeColor\<TPanel>(panel, value)

Sets the foreground color of the panel's header.

| Parameter  | Type                                                                           | Description                                                                                                              |
| ---------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md).                    |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                                     |
| **value**  | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color)            | The [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) representing the foreground color of the header. |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header foreground color.

### ![](/files/lIX317sDtMTZJBi9oSIx) HeaderPosition\<TPanel>(panel, value)

Sets the position of the panel's header.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **value**  | [HeaderPosition](/api/wisej.web/enumerations/wisej.web.headerposition.md)      | The [HeaderPosition](#headerposition``1) indicating the position of the header.                       |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header position.

### ![](/files/lIX317sDtMTZJBi9oSIx) HeaderSize\<TPanel>(panel, value)

Sets the size of the panel's header.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **value**  | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                    | An integer value representing the size of the header.                                                 |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header size.

### ![](/files/lIX317sDtMTZJBi9oSIx) OnPanelCollapsed\<TPanel>(panel, action)

Registers an action to be executed when the panel is collapsed.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **action** | [Action\<TPanel>](https://docs.microsoft.com/dotnet/api/system.action-1)       | The action to execute when the panel is collapsed.                                                    |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the registered collapse action.

This method allows you to specify a custom action that will be triggered whenever the panel is collapsed.

```csharp

panel.OnPanelCollapsed(p => AlertBox.Show("Panel collapsed"));

```

### ![](/files/lIX317sDtMTZJBi9oSIx) OnPanelExpanded\<TPanel>(panel, action)

Registers an action to be executed when the panel is expanded.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **action** | [Action\<TPanel>](https://docs.microsoft.com/dotnet/api/system.action-1)       | The action to execute when the panel is expanded.                                                     |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the registered expand action.

This method allows you to specify a custom action that will be triggered whenever the panel is expanded.

```csharp

panel.OnPanelExpanded(p => AlertBox.Show("Panel expanded"));

```

### ![](/files/lIX317sDtMTZJBi9oSIx) ShowHeader\<TPanel>(panel, value)

Sets the visibility of the panel's header.

| Parameter  | Type                                                                           | Description                                                                                           |
| ---------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| **TPanel** |                                                                                | The type of the panel, which must inherit from [Panel](/api/wisej.web/containers/wisej.web.panel.md). |
| **panel**  | [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md) | The panel to modify.                                                                                  |
| **value**  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                | A boolean value indicating whether the header should be visible.                                      |

**Returns:** [TPanel](/api/wisej.web.markup/extensions/wisej.web.markup.panelextensions.md). The modified panel with the updated header visibility.


---

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