# ListViewItem

URL: https://docs.wisej.com/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem

Version: 4.1
Namespace: **Wisej.Web**

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

Represents an item in aListView control.

- C# - VB.NET

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

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

## Constructors

### ![Instance member](/img/api/instance.png) ListViewItem()

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

### ![Instance member](/img/api/instance.png) ListViewItem(text)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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. 

### ![Instance member](/img/api/instance.png) ListViewItem(items)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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. 

### ![Instance member](/img/api/instance.png) ListViewItem(text, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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 theImageList associated with theListView that contains the item. 

### ![Instance member](/img/api/instance.png) ListViewItem(items, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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 theImageList associated with theListView that contains the item. 

### ![Instance member](/img/api/instance.png) ListViewItem(items, imageIndex, foreColor, backColor, font)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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 theImageList associated with theListView 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](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem#font) that represents the font to display the item's text in. 

### ![Instance member](/img/api/instance.png) ListViewItem(subItems, imageIndex)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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) objects.

| Name | Type | Description | **subItems** | [ListViewSubItem[]](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem) | An array of type [ListViewSubItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.listviewsubitem) 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 theImageList associated with theListView that contains the item. 

### ![Instance member](/img/api/instance.png) ListViewItem(text, imageKey)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem#imagelist) of the owningListView to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) . 

### ![Instance member](/img/api/instance.png) ListViewItem(items, imageKey)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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) . | **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the image within the [ImageList](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem#imagelist) of the owningListView to display in the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) . 

### ![Instance member](/img/api/instance.png) ListViewItem(items, imageKey, foreColor, backColor, font)

Initializes a new instance of the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem) 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) . | **imageKey** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the image within the [ImageList](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem#imagelist) of the owningListView 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](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem#font) to apply to the item text. 

### ![Instance member](/img/api/instance.png) ListViewItem(subItems, imageKey)

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

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

## Properties

### ![Instance member](/img/api/instance.png) 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/>".

### ![Instance member](/img/api/instance.png) BackColor

[Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) : Returns or sets the background color of theListView .

### ![Instance member](/img/api/instance.png) Checked

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

### ![Instance member](/img/api/instance.png) 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 theListView is in [Details](/api/wisej.web/lists-and-grids/listview/wisej.web.view#fields) mode. (Default: `1` )

**Throws:**

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

### ![Instance member](/img/api/instance.png) ContextMenu

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

### ![Instance member](/img/api/instance.png) Control

Control : Returns or sets a child control to display inside the item.

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) Focused

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) : Return or sets whether the item has the focus within theListView parent.

### ![Instance member](/img/api/instance.png) Font

[Font](https://docs.microsoft.com/dotnet/api/system.drawing.font) : Returns or sets the font of the text displayed by theListView .

### ![Instance member](/img/api/instance.png) ForeColor

[Color](https://docs.microsoft.com/dotnet/api/system.drawing.color) : Returns or sets the foreground color of theListView .

### ![Instance member](/img/api/instance.png) HasUserData

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) 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) . (Default: `-1` )

**Throws:**

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

### ![Instance member](/img/api/instance.png) 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#imagelist) . (Default: `""` )

### ![Instance member](/img/api/instance.png) ImageList

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) Index

[Int32](https://docs.microsoft.com/dotnet/api/system.int32) : Returns the zero-based index of the item within theListView control.

### ![Instance member](/img/api/instance.png) IsDataBound

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

### ![Instance member](/img/api/instance.png) IsEditing

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

### ![Instance member](/img/api/instance.png) ListView

ListView : Returns theListView control that contains the item.

### ![Instance member](/img/api/instance.png) Name

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

### ![Instance member](/img/api/instance.png) 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#fields) view.

### ![Instance member](/img/api/instance.png) 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 theListView is in [Details](/api/wisej.web/lists-and-grids/listview/wisej.web.view#fields) mode. (Default: `1` )

**Throws:**

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

### ![Instance member](/img/api/instance.png) Selected

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

### ![Instance member](/img/api/instance.png) 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) . (Default: `-1` )

**Throws:**

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

### ![Instance member](/img/api/instance.png) 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#imagelist) . (Default: `""` )

### ![Instance member](/img/api/instance.png) StateImageList

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) SubItems

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

### ![Instance member](/img/api/instance.png) 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` )

### ![Instance member](/img/api/instance.png) Text

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

### ![Instance member](/img/api/instance.png) 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) . (Default: `""` )

### ![Instance member](/img/api/instance.png) 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.

### ![Instance member](/img/api/instance.png) Visible

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

## Methods

### ![Instance member](/img/api/instance.png) 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/#labeledit) property of the associatedListView is not set to true.

### ![Instance member](/img/api/instance.png) 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.

### ![Instance member](/img/api/instance.png) Dispose()

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

### ![Protected member](/img/api/protected.png) Dispose(disposing)

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

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

### ![Instance member](/img/api/instance.png) EnsureVisible()

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

### ![Protected member](/img/api/protected.png) Finalize()

Destructor dispose pattern.

### ![Instance member](/img/api/instance.png) Remove()

Removes the item from its associatedListView control.

## Implements

| Name | Description | [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata) | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. | [IImage](/api/wisej.web/interfaces/wisej.web.iimage) | Provides access to common image properties across the controls that implement this interface.
