# ListView\.ColumnHeaderCollection

Namespace: **Wisej.Web**

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

Represents the collection of column headers in a [ListView](/api/wisej.web/lists-and-grids/listview.md) control.

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

```csharp
public class ColumnHeaderCollection : IList, ICollection, IEnumerable, IList<ColumnHeader>, ICollection<ColumnHeader>, IEnumerable<ColumnHeader>
```

{% endtab %}

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

```visual-basic
Public Class ColumnHeaderCollection
    Inherits IList
    Implements ICollection, IEnumerable, IList(Of ColumnHeader), ICollection(Of ColumnHeader), IEnumerable(Of ColumnHeader)
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) ColumnHeaderCollection(owner)

Initializes a new instance of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md) class.

| Name      | Type                                                   | Description                                                                           |
| --------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| **owner** | [ListView](/api/wisej.web/lists-and-grids/listview.md) | The [ListView](/api/wisej.web/lists-and-grids/listview.md) that owns this collection. |

## Properties

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the number of items in the collection.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns whether the collection is read-only.

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

[ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md): Returns the column header at the specified index within the collection.

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than or equal to the value of the [Count](#count) property of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(key)

[ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md): Returns the column header with the specified key from the collection.

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(text, width, textAlign)

Adds a column header to the collection with specified text, width, and alignment settings.

| Parameter     | Type                                                                                | Description                                                                                            |
| ------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **text**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the column header.                                                              |
| **width**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width of the column header.                                                                |
| **textAlign** | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values. |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) that was created and added to the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(header)

Adds an existing [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to the collection.

| Parameter  | Type                                                                              | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **header** | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to add to the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index into the collection where the item was added.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(text)

Creates and adds a column with the specified text to the collection.

| Parameter | Type                                                          | Description                               |
| --------- | ------------------------------------------------------------- | ----------------------------------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the column header. |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the specified text that was added to the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(text, width)

Creates and adds a column with the specified text and width to the collection.

| Parameter | Type                                                          | Description                                                                                                                  |
| --------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text of the [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to add to the collection.  |
| **width** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The width of the [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to add to the collection. |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the specified text and width that was added to the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text)

Creates and adds a column with the specified text and key to the collection.

| Parameter | Type                                                          | Description                                                                                                                 |
| --------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to add to the collection.  |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text of the [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to add to the collection. |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the specified key and text that was added to the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, width)

Creates and adds a column with the specified text, key, and width to the collection.

| Parameter | Type                                                          | Description                                                                                                 |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The key of the column header.                                                                               |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the column header.                                                                   |
| **width** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The initial width of the [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the given text, key, and width that was added to the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, width, textAlign, imageKey)

Creates and adds a column with the specified key, aligned text, width, and image key to the collection.

| Parameter     | Type                                                                                | Description                                                                                            |
| ------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **key**       | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The key of the column header.                                                                          |
| **text**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the column header.                                                              |
| **width**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width of the column header.                                                                |
| **textAlign** | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values. |
| **imageKey**  | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The key value of the image to display in the column header.                                            |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the specified key, aligned text, width, and image key that has been added to the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(key, text, width, textAlign, imageIndex)

Creates and adds a column with the specified key, aligned text, width, and image index to the collection.

| Parameter      | Type                                                                                | Description                                                                                            |
| -------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The key of the column header.                                                                          |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the column header.                                                              |
| **width**      | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width of the column header.                                                                |
| **textAlign**  | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values. |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The index value of the image to display in the column.                                                 |

**Returns:** [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md). The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) with the specified key, aligned text, width, and image index that has been added to the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) AddRange(headers)

Adds an array of column headers to the collection.

| Parameter   | Type                                                                                  | Description                                                                                                                     |
| ----------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **headers** | [ColumnHeader\[\]](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | An array of [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) objects to add to the collection. |

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

Removes all column headers from the collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear(dispose)

Removes all column headers from the collection and optionally disposes them.

| Parameter   | Type                                                            | Description                                                              |
| ----------- | --------------------------------------------------------------- | ------------------------------------------------------------------------ |
| **dispose** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates that the child columns should be disposed after being removed. |

### ![](/files/hsR4ok3152WyAf8J2C1u) Contains(header)

Determines whether the specified header is located in the collection.

| Parameter  | Type                                                                              | Description                                                                                                                              |
| ---------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **header** | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | A [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) representing the header to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the header is contained in the collection; otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) ContainsKey(key)

Determines if a header with the specified key is contained in the collection.

| Parameter | Type                                                          | Description                           |
| --------- | ------------------------------------------------------------- | ------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the header to search for. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if a header with the specified name is contained in the collection; otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) CopyTo(array, arrayIndex)

| Parameter      | Type                                                                                  | Description |
| -------------- | ------------------------------------------------------------------------------------- | ----------- |
| **array**      | [ColumnHeader\[\]](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) |             |
| **arrayIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                           |             |

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

Returns an enumerator to use to iterate through the column header collection.

**Returns:** [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator). An [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator) that represents the column header collection.

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOf(value)

Returns the index, within the collection, of the specified header.

| Parameter | Type                                                                              | Description                                                                                                                              |
| --------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **value** | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | A [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) representing the header to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the header's location in the collection. If the header is not located in the collection, the return value is -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) IndexOfKey(key)

Determines the index for a header with the specified key.

| Parameter | Type                                                          | Description                                       |
| --------- | ------------------------------------------------------------- | ------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the header to retrieve the index for. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index for the first occurrence of the column with the specified name, if found; otherwise, -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, header)

Inserts an existing header into the collection at the specified index.

| Parameter  | Type                                                                              | Description                                                                                                          |
| ---------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **index**  | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                       | The zero-based index location where the header is inserted.                                                          |
| **header** | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | The [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) to insert into the collection. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than or equal to the value of the [Count](#count) property of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, text, width, textAlign)

Creates a new column header and inserts it into the collection at the specified index.

| Parameter     | Type                                                                                | Description                                                                                                                                                                                 |
| ------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **index**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The zero-based index location where the header is inserted.                                                                                                                                 |
| **text**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the header.                                                                                                                                                          |
| **width**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width of the header. Set to -1 to autosize the header to the size of the largest subitem text in the column or -2 to autosize the header to the size of the text of the header. |
| **textAlign** | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values.                                                                                      |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than or equal to the value of the [Count](#count) property of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, text)

Creates a new column with the specified text, and inserts the header into the collection at the specified index.

| Parameter | Type                                                          | Description                                                 |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the header is inserted. |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the header.                          |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than or equal to the value of the [Count](#count) property of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, text, width)

Creates a new header with the specified text and initial width, and inserts the header into the collection at the specified index.

| Parameter | Type                                                          | Description                                                 |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the header is inserted. |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the header.                          |
| **width** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The initial width, in pixels, of the header.                |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text)

Creates a new header with the specified text and key, and inserts the header into the collection at the specified index.

| Parameter | Type                                                          | Description                                                 |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the header is inserted. |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the header.                                     |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the header.                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, width)

Creates a new column with the specified text, key, and width, and inserts the header into the collection at the specified index.

| Parameter | Type                                                          | Description                                                 |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index location where the header is inserted. |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the header.                                     |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display in the header.                          |
| **width** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The initial width, in pixels, of the header.                |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, width, textAlign, imageKey)

Creates a new header with the specified aligned text, key, width, and image key, and inserts the header into the collection at the specified index.

| Parameter     | Type                                                                                | Description                                                                                            |
| ------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **index**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The zero-based index location where the column header is inserted.                                     |
| **key**       | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The name of the header.                                                                                |
| **text**      | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the header.                                                                     |
| **width**     | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width, in pixels, of the header.                                                           |
| **textAlign** | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values. |
| **imageKey**  | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The key of the image to display in the header.                                                         |

### ![](/files/hsR4ok3152WyAf8J2C1u) Insert(index, key, text, width, textAlign, imageIndex)

Creates a new header with the specified aligned text, key, width, and image index, and inserts the header into the collection at the specified index.

| Parameter      | Type                                                                                | Description                                                                                            |
| -------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **index**      | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The zero-based index location where the column header is inserted.                                     |
| **key**        | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The name of the header.                                                                                |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The text to display in the column header.                                                              |
| **width**      | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The initial width, in pixels, of the header.                                                           |
| **textAlign**  | [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) | One of the [HorizontalAlignment](/api/wisej.web/enumerations/wisej.web.horizontalalignment.md) values. |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                         | The index of the image to display in the header.                                                       |

### ![](/files/lzopMboA31bVq8UIcbT3) OnCollectionChanged(action, element)

Fires the [CollectionChanged](#collectionchanged) event.

| Parameter   | Type                                                                                                         | Description                                                                                                                                                           |
| ----------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **action**  | [CollectionChangeAction](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeaction) | One of [CollectionChangeAction](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeaction) indicating the reason the collection has changed. |
| **element** | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                | The element that was added or removed from the collection, or null.                                                                                                   |

### ![](/files/hsR4ok3152WyAf8J2C1u) Remove(column)

Removes the specified header from the collection.

| Parameter  | Type                                                                              | Description                                                                                                                                |
| ---------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| **column** | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) | A [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md) representing the header to remove from the collection. |

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

Removes the header at the specified index within the collection.

| Parameter | Type                                                        | Description                                   |
| --------- | ----------------------------------------------------------- | --------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The zero-based index of the header to remove. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)*index* is less than 0 or greater than or equal to the value of the [Count](#count) property of the [ColumnHeaderCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) RemoveByKey(key)

Removes the header with the specified key from the collection.

| Parameter | Type                                                          | Description                                           |
| --------- | ------------------------------------------------------------- | ----------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the header to remove from the collection. |

## Events

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

[CollectionChangeEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeeventhandler) Fired when the collection changes.


---

# 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/lists-and-grids/listview/wisej.web.listview.columnheadercollection.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.
