# ListView\.ColumnHeaderCollection

Namespace: **Wisej.Web**

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

Represents the collection of column headers in a [ListView](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview) 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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ColumnHeaderCollection(owner)

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

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

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Count

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IsReadOnly

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(index)

[ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader): 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(key)

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

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) values. |

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Add(header)

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

| Parameter  | Type                                                                                                 | Description                                                                                                                        |
| ---------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **header** | [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) | The [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader). The [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) with the specified text that was added to the [ColumnHeaderCollection](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) to add to the collection.  |
| **width** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The width of the [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) to add to the collection. |

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) to add to the collection.  |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text of the [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) to add to the collection. |

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader). |

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader). The [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) with the specified key, aligned text, width, and image key that has been added to the collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) values. |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                            | The index value of the image to display in the column.                                                                    |

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) AddRange(headers)

Adds an array of column headers to the collection.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Clear()

Removes all column headers from the collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Contains(header)

Determines whether the specified header is located in the collection.

| Parameter  | Type                                                                                                 | Description                                                                                                                                                 |
| ---------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **header** | [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) | A [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CopyTo(array, arrayIndex)

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IndexOf(value)

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

| Parameter | Type                                                                                                 | Description                                                                                                                                                 |
| --------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **value** | [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) | A [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) | The [ColumnHeader](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.                |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.                          |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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.                |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) values. |
| **imageKey**  | [String](https://docs.microsoft.com/dotnet/api/system.string)                                          | The key of the image to display in the header.                                                                            |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) | One of the [HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment) values. |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                            | The index of the image to display in the header.                                                                          |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) 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.                                                                                                   |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Remove(column)

Removes the specified header from the collection.

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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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](https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listview.columnheadercollection).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) 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

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CollectionChanged

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