# Accordion

Namespace: **Wisej.Web**

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

* [Control](/api/wisej.web/general/control.md)
  * [Accordion](/api/wisej.web/containers/accordion.md)

Displays collapsible set of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panels for presenting information in a limited amount of space.

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

```csharp
public class Accordion : Control, ISupportInitialize
```

{% endtab %}

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

```visual-basic
Public Class Accordion
    Inherits Control
    Implements ISupportInitialize
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) Accordion()

Initializes a new instance of the [Accordion](/api/wisej.web/containers/accordion.md) class.

### ![](/files/hsR4ok3152WyAf8J2C1u) Accordion(panels, onSelectedIndexChanged)

Initializes a new instance of the [Accordion](/api/wisej.web/containers/accordion.md) class with the specified settings.

| Name                       | Type                                                                                  | Description                                                                                                                     |
| -------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **panels**                 | [AccordionPanel\[\]](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | An array of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) objects to be added to the panel. |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2)   | An Action delegate to handle the [SelectedIndexChanged](#selectedindexchanged) event.                                           |

### ![](/files/hsR4ok3152WyAf8J2C1u) Accordion(location, size, onSelectedIndexChanged)

Initializes a new instance of the [Accordion](/api/wisej.web/containers/accordion.md) class with the specified settings.

| Name                       | Type                                                                                | Description                                                                           |
| -------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| **location**               | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                 | The location of the panel on its parent control.                                      |
| **size**                   | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                   | The size of the panel.                                                                |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An Action delegate to handle the [SelectedIndexChanged](#selectedindexchanged) event. |

### ![](/files/hsR4ok3152WyAf8J2C1u) Accordion(location, size, panels, onSelectedIndexChanged)

Initializes a new instance of the [Accordion](/api/wisej.web/containers/accordion.md) class with the specified settings.

| Name                       | Type                                                                                  | Description                                                                                                                     |
| -------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **location**               | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                   | The location of the panel on its parent control.                                                                                |
| **size**                   | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                     | The size of the panel.                                                                                                          |
| **panels**                 | [AccordionPanel\[\]](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | An array of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) objects to be added to the panel. |
| **onSelectedIndexChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2)   | An Action delegate to handle the [SelectedIndexChanged](#selectedindexchanged) event.                                           |

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) BorderStyle

[BorderStyle](/api/wisej.web/enumerations/wisej.web.borderstyle.md): Returns or sets the type of border that is drawn around the [Accordion](/api/wisej.web/containers/accordion.md) panel. (Default: `Solid`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ClientArea

[Rectangle](https://docs.microsoft.com/dotnet/api/system.drawing.rectangle): Returns the client rectangle to use in the designer.

### ![](/files/hsR4ok3152WyAf8J2C1u) Collapsible

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating whether the Accordion control collapses when all the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) children are collapsed. (Default: `False`)

When this property is set to false (default) one panel is always expanded.

### ![](/files/hsR4ok3152WyAf8J2C1u) DisplayRectangle

[Rectangle](https://docs.microsoft.com/dotnet/api/system.drawing.rectangle): Returns the rectangle that represents the virtual display area of the control.

### ![](/files/hsR4ok3152WyAf8J2C1u) HeaderSize

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the size of the header. When the header is horizontal, the size if the height; when it's vertical, the size if the width. Set it to -1 to reset to the size set in the current theme.

### ![](/files/hsR4ok3152WyAf8J2C1u) ImageList

[ImageList](/api/wisej.web/content/imagelist.md): Returns or sets the images to display on the panel's title bar. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) PanelCount

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of panels in the container. (Default: `0`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Panels

[PanelCollection](/api/wisej.web/containers/accordion/wisej.web.accordion.panelcollection.md): Returns the collection of panels in the container.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedIndex

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the index of the currently selected panel. (Default: `-1`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The value is less than -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedOnTop

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating whether the selected panel is moved to the top of the [Accordion](/api/wisej.web/containers/accordion.md) container. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedPanel

[AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md): Returns or sets the currently selected panel. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ShowToolTips

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether a panel's ToolTip is shown when the mouse passes over the panel's title. (Default: `True`)

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) CreateControlsInstance()

This member overrides [CreateControlsInstance](/api/wisej.web/general/control.md#createcontrolsinstance).

**Returns:** [ControlCollection](/api/wisej.web/general/control/wisej.web.control.controlcollection.md). A new instance of [ControlCollection](/api/wisej.web/general/control/wisej.web.control.controlcollection.md) assigned to the control.

### ![](/files/hsR4ok3152WyAf8J2C1u) DeselectPanel(index)

Makes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) following the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified index the current panel.

| Parameter | Type                                                        | Description                                                                                                                                         |
| --------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The index in the [Panels](#panels) collection of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to deselect. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than the number of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) controls in the [Panels](#panels) collection minus 1.

### ![](/files/hsR4ok3152WyAf8J2C1u) DeselectPanel(panel)

Makes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) following the specified [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) the current panel.

| Parameter | Type                                                                              | Description                                                                                        |
| --------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to deselect. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*panel* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) DeselectPanel(panelName)

Makes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) following the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) the specified name the current panel.

| Parameter     | Type                                                          | Description                                                                  |
| ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| **panelName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [Name](/api/wisej.web/general/control.md#name) of the panel to deselect. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*panelName* is null; or *panelName* does not match the [Name](/api/wisej.web/general/control.md#name) property of any [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) in the [Panels](#panels) collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) GetControl(index)

Returns the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) panel at the specified location.

| Parameter | Type                                                        | Description                                                                                                |
| --------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The index of the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to get. |

**Returns:** [Control](/api/wisej.web/general/control.md). The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) at the specified location.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than the number of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) controls in the [Panels](#panels) collection minus 1.

### ![](/files/lzopMboA31bVq8UIcbT3) GetItems()

Returns an array of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) controls that belong to the [Accordion](/api/wisej.web/containers/accordion.md) control.

**Returns:** [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object). An array of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) controls that belong to the [Accordion](/api/wisej.web/containers/accordion.md).

### ![](/files/lzopMboA31bVq8UIcbT3) GetToolTipText(item)

Returns the ToolTip for the specified [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter | Type                                                          | Description                                                                                                          |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **item**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) that owns the desired ToolTip. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The ToolTip text.

### ![](/files/lzopMboA31bVq8UIcbT3) OnControlAdded(e)

Fires the [ControlAdded](/api/wisej.web/general/control.md#controladded) event.

| Parameter | Type                                                                             | Description |
| --------- | -------------------------------------------------------------------------------- | ----------- |
| **e**     | [ControlEventArgs](/api/wisej.web/general/control/wisej.web.controleventargs.md) |             |

### ![](/files/lzopMboA31bVq8UIcbT3) OnDeselected(e)

Fires the [Deselected](#deselected) event.

| Parameter | Type                                                                                      | Description                                                                                                                  |
| --------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [AccordionEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioneventargs.md) | A [TabControlEventArgs](/api/wisej.web/containers/tabcontrol/wisej.web.tabcontroleventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnDeselecting(e)

Fires the [Deselecting](#deselecting) event.

| Parameter | Type                                                                                                  | Description                                                                                                                           |
| --------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [AccordionCancelEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventargs.md) | A [AccordionCancelEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnEnter(e)

Fires the [Enter](/api/wisej.web/general/control.md#enter) event of the currently active [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnLayout(e)

Fires the [Layout](/api/wisej.web/general/control.md#layout) event.

| Parameter | Type                                                                           | Description                                                                                                    |
| --------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| **e**     | [LayoutEventArgs](/api/wisej.web/general/control/wisej.web.layouteventargs.md) | A [LayoutEventArgs](/api/wisej.web/general/control/wisej.web.layouteventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnLeave(e)

Fires the [Leave](/api/wisej.web/general/control.md#leave) event of the currently active [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnSelected(e)

Fires the [Selected](#selected) event.

| Parameter | Type                                                                                      | Description                                                                                                               |
| --------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [AccordionEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioneventargs.md) | A [AccordionEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioneventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnSelectedIndexChanged(e)

Fires the [SelectedIndexChanged](#selectedindexchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnSelecting(e)

Fires the [Selecting](#selecting) event.

| Parameter | Type                                                                                                  | Description                                                                                                                           |
| --------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [AccordionCancelEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventargs.md) | A [AccordionCancelEventArgs](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventargs.md) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                        | Description      |
| --------- | ----------------------------------------------------------- | ---------------- |
| **e**     | [WisejEventArgs](/api/wisej.core/general/wisejeventargs.md) | Event arguments. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](/files/lzopMboA31bVq8UIcbT3) RemoveAll()

Removes all the panels and additional controls from this tab control.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectPanel(index)

Makes the [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified index the current [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter | Type                                                        | Description                                                         |
| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The index in the [Panels](#panels) collection of the tab to select. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than the number of [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) controls in the [Panels](#panels) collection minus 1.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectPanel(panel)

Makes the specified [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) the current [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter | Type                                                                              | Description                                                                                      |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **panel** | [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) | The [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) to select. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*panel* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectPanel(panelName)

Makes [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) with the specified name the current [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md).

| Parameter     | Type                                                          | Description                                                              |
| ------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------ |
| **panelName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The [Name](/api/wisej.web/general/control.md#name) of the tab to select. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*panelName* is null; or *panelName* does not match the [Name](/api/wisej.web/general/control.md#name) property of any [AccordionPanel](/api/wisej.web/containers/accordion/wisej.web.accordionpanel.md) in the [Panels](#panels) collection.

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) Deselected

[AccordionEventHandler](/api/wisej.web/containers/accordion/wisej.web.accordioneventhandler.md) Fired when a panel is deselected.

### ![](/files/hsR4ok3152WyAf8J2C1u) Deselecting

[AccordionCancelEventHandler](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventhandler.md) Occurs before a panel is deselected, enabling a handler to cancel the panel change.

### ![](/files/hsR4ok3152WyAf8J2C1u) Selected

[AccordionEventHandler](/api/wisej.web/containers/accordion/wisej.web.accordioneventhandler.md) Fired when a panel is selected.

### ![](/files/hsR4ok3152WyAf8J2C1u) SelectedIndexChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [SelectedIndex](#selectedindex) property has changed.

### ![](/files/hsR4ok3152WyAf8J2C1u) Selecting

[AccordionCancelEventHandler](/api/wisej.web/containers/accordion/wisej.web.accordioncanceleventhandler.md) Occurs before a panel is selected, enabling a handler to cancel the panel change.

## Implements

| Name                                                                              | Description                                                                                                           |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.       |
| [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                         |
| [IDropTarget](/api/wisej.web/interfaces/wisej.web.idroptarget.md)                 | Controls that support drag & drop operations implement this interface.                                                |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                        |
| [IWisejControl](/api/wisej.core/interfaces/wisej.core.iwisejcontrol.md)           | All wisej controls derived from the [Control](/api/wisej.web/general/control.md) class must implement this interface. |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                                 |


---

# 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/containers/accordion.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.
