# ListViewItem

Namespace: **Wisej.Web**

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

Represents an item in a [ListView](/api/wisej.web/lists-and-grids/listview.md) control.

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

```csharp
public class ListViewItem : ICloneable, IDisposable, IHasPropertyStore, IImage, IUserData
```

{% endtab %}

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

```visual-basic
Public Class ListViewItem
    Inherits ICloneable
    Implements IDisposable, IHasPropertyStore, IImage, IUserData
```

{% endtab %}
{% endtabs %}

## Constructors

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

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with default values.

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

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the specified item text.

| Name     | Type                                                          | Description                       |
| -------- | ------------------------------------------------------------- | --------------------------------- |
| **text** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display for the item. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(items)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with an array of strings representing sub-items.

| Name      | Type                                                              | Description                                                       |
| --------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| **items** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of strings that represent the sub-items of the new item. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(text, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the specified item text and the image index position of the item's icon.

| Name           | Type                                                          | Description                                                                                                                                                                                      |
| -------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display for the item.                                                                                                                                                                |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The zero-based index of the image within the [ImageList](/api/wisej.web/content/imagelist.md) associated with the [ListView](/api/wisej.web/lists-and-grids/listview.md) that contains the item. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(items, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the image index position of the item's icon and an array of strings representing sub-items.

| Name           | Type                                                              | Description                                                                                                                                                                                      |
| -------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **items**      | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of strings that represent the sub-items of the new item.                                                                                                                                |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)       | The zero-based index of the image within the [ImageList](/api/wisej.web/content/imagelist.md) associated with the [ListView](/api/wisej.web/lists-and-grids/listview.md) that contains the item. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(items, imageIndex, foreColor, backColor, font)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the image index position of the item's icon; the foreground color, background color, and font of the item; and an array of strings representing sub-items.

| Name           | Type                                                                | Description                                                                                                                                                                                      |
| -------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **items**      | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string)   | An array of strings that represent the sub-items of the new item.                                                                                                                                |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)         | The zero-based index of the image within the [ImageList](/api/wisej.web/content/imagelist.md) associated with the [ListView](/api/wisej.web/lists-and-grids/listview.md) that contains the item. |
| **foreColor**  | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) | A [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) that represents the foreground color of the item.                                                                          |
| **backColor**  | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) | A [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) that represents the background color of the item.                                                                          |
| **font**       | [Font](https://docs.microsoft.com/dotnet/api/system.drawing.font)   | A [Font](#font) that represents the font to display the item's text in.                                                                                                                          |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(subItems, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the image index position of the item's icon and an array of [ListViewSubItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem.md) objects.

| Name           | Type                                                                                                     | Description                                                                                                                                                                                      |
| -------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **subItems**   | [ListViewSubItem\[\]](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem.md) | An array of type [ListViewSubItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem.md) that represents the sub-items of the item.                                 |
| **imageIndex** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                              | The zero-based index of the image within the [ImageList](/api/wisej.web/content/imagelist.md) associated with the [ListView](/api/wisej.web/lists-and-grids/listview.md) that contains the item. |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(text, imageKey)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the specified text and image.

| Name         | Type                                                          | Description                                                                                                                                                                                                                        |
| ------------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **text**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display for the item. This should not exceed 259 characters.                                                                                                                                                           |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the image within the [ImageList](#imagelist) of the owning [ListView](/api/wisej.web/lists-and-grids/listview.md) to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(items, imageKey)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the specified item and sub-item text and image.

| Name         | Type                                                              | Description                                                                                                                                                                                                                        |
| ------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **items**    | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array containing the text of the sub-items of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).                                                                                            |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string)     | The name of the image within the [ImageList](#imagelist) of the owning [ListView](/api/wisej.web/lists-and-grids/listview.md) to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(items, imageKey, foreColor, backColor, font)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the sub-items containing the specified text, image, colors, and font.

| Name          | Type                                                                | Description                                                                                                                                             |
| ------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **items**     | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string)   | An array of strings that represent the text of the sub-items for the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). |
| **imageKey**  | [String](https://docs.microsoft.com/dotnet/api/system.string)       | The name of the image within the [ImageList](#imagelist) of the owning [ListView](/api/wisej.web/lists-and-grids/listview.md) to display in the item.   |
| **foreColor** | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) | A [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) that represents the foreground color of the item.                                 |
| **backColor** | [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) | A [Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) that represents the background color of the item.                                 |
| **font**      | [Font](https://docs.microsoft.com/dotnet/api/system.drawing.font)   | A [Font](#font) to apply to the item text.                                                                                                              |

### ![](/files/hsR4ok3152WyAf8J2C1u) ListViewItem(subItems, imageKey)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) class with the specified sub-items and image.

| Name         | Type                                                                                                     | Description                                                                                                                                                                                                                        |
| ------------ | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **subItems** | [ListViewSubItem\[\]](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem.md) | An array of [ListViewSubItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem.md) objects.                                                                                                          |
| **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string)                                            | The name of the image within the [ImageList](#imagelist) of the owning [ListView](/api/wisej.web/lists-and-grids/listview.md) to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). |

## Properties

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating that the item can display HTML text. (Default: `False`)

When AllowHtml is set to true, the text in the item can contain HTML content. If the text contains new lines (CRLF) but doesn't contain HTML elements (at least one "<") all CRLF are automatically substituted with "\<br/>".

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

[Color](https://docs.microsoft.com/dotnet/api/system.drawing.color): Returns or sets the background color of the [ListView](/api/wisej.web/lists-and-grids/listview.md).

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the item is checked. (Default: `False`)

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the number of columns that this item can use to render its content when the [ListView](/api/wisej.web/lists-and-grids/listview.md) is in [Details](/api/wisej.web/lists-and-grids/listview/wisej.web.view.md#fields) mode. (Default: `1`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The value is lower than 1 or greater than 100.

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

[ContextMenu](/api/wisej.web/menus/wisej.web.contextmenu.md): Returns or sets the shortcut menu associated with the item. (Default: `null`)

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

[Control](/api/wisej.web/general/control.md): Returns or sets a child control to display inside the item.

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

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns the data-bound object for this [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Return or sets whether the item has the focus within the [ListView](/api/wisej.web/lists-and-grids/listview.md) parent.

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

[Font](https://docs.microsoft.com/dotnet/api/system.drawing.font): Returns or sets the font of the text displayed by the [ListView](/api/wisej.web/lists-and-grids/listview.md).

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

[Color](https://docs.microsoft.com/dotnet/api/system.drawing.color): Returns or sets the foreground color of the [ListView](/api/wisej.web/lists-and-grids/listview.md).

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Checks if the [UserData](#userdata) dynamic object was created and has any value.

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

[Image](https://docs.microsoft.com/dotnet/api/system.drawing.image): Returns or sets the image that is displayed on a [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the image list index value of the image displayed in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). (Default: `-1`)

**Throws:**

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

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the key accessor for the image in the [ImageList](/api/wisej.web/buttons/wisej.web.buttonbase.md#imagelist). (Default: `""`)

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

[ImageList](/api/wisej.web/content/imagelist.md): Returns the [ImageList](/api/wisej.web/content/imagelist.md) that contains the images displayed in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the theme name or URL for the image to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the zero-based index of the item within the [ListView](/api/wisej.web/lists-and-grids/listview.md) control.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns whether the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) is data bound.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the tree node is in an editable state.

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

[ListView](/api/wisej.web/lists-and-grids/listview.md): Returns the [ListView](/api/wisej.web/lists-and-grids/listview.md) control that contains the item.

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name associated with this item.

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the height of the row corresponding to this item when in [Details](/api/wisej.web/lists-and-grids/listview/wisej.web.view.md#fields) view.

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the number of rows that this item can use to render its content when the [ListView](/api/wisej.web/lists-and-grids/listview.md) is in [Details](/api/wisej.web/lists-and-grids/listview/wisej.web.view.md#fields) mode. (Default: `1`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The value is lower than 1 or greater than 100.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the item is selected.

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

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the image list index value of the state icon displayed in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). (Default: `-1`)

**Throws:**

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

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the key for the state icon displayed in the [ImageList](/api/wisej.web/buttons/wisej.web.buttonbase.md#imagelist). (Default: `""`)

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

[ImageList](/api/wisej.web/content/imagelist.md): Returns the [ImageList](/api/wisej.web/content/imagelist.md) that contains the state images displayed in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the theme name or URL for the state icon to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

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

[ListViewSubItemCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitemcollection.md): Returns a collection containing all sub items.

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

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns or sets an object that contains data to associate with the item. (Default: `null`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text of the item. (Default: `""`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text shown when the mouse pointer rests on the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md). (Default: `""`)

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

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns a dynamic object that can be used to store custom data in relation to this item.

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the item is visible.

## Methods

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

Places the item in edit mode.

**Throws:**

* [InvalidOperationException](https://docs.microsoft.com/dotnet/api/system.invalidoperationexception)\
  The [LabelEdit](/api/wisej.web/lists-and-grids/listview.md#labeledit) property of the associated [ListView](/api/wisej.web/lists-and-grids/listview.md) is not set to true.

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

Creates an identical copy of the item.

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An object that represents an item that has the same text, image, and sub-items associated with it as the cloned item.

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

Releases all resources used by the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

### ![](/files/lzopMboA31bVq8UIcbT3) Dispose(disposing)

Releases the resources used by the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md).

| Parameter     | Type                                                            | Description                                                                 |
| ------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true when this method is called by the application rather than a finalizer. |

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

Ensures that the item is visible within the control, scrolling the contents of the control, if necessary.

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

Destructor dispose pattern.

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

Removes the item from its associated [ListView](/api/wisej.web/lists-and-grids/listview.md) control.

## 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. |
| [IImage](/api/wisej.web/interfaces/wisej.web.iimage.md)       | Provides access to common image properties across the controls that implement this interface.                   |


---

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