# ListView\.SelectedListViewItemCollection

Namespace: **Wisej.Web**

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

Represents the collection that contains the selected items in a [ListView](/api/wisej.web/lists-and-grids/listview.md) control.

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

```csharp
public class SelectedListViewItemCollection : IList<ListViewItem>, ICollection<ListViewItem>, IEnumerable<ListViewItem>, IEnumerable, IList, ICollection
```

{% endtab %}

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

```visual-basic
Public Class SelectedListViewItemCollection
    Inherits IList(Of ListViewItem)
    Implements ICollection(Of ListViewItem), IEnumerable(Of ListViewItem), IEnumerable, IList, ICollection
```

{% endtab %}
{% endtabs %}

## Constructors

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

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

| Name      | Type                                                   | Description                                                                                |
| --------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| **owner** | [ListView](/api/wisej.web/lists-and-grids/listview.md) | A [ListView](/api/wisej.web/lists-and-grids/listview.md) control that owns the 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)

[ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md): Returns the item value at the specified index within the collection.

**Throws:**

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

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

[ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md): Returns the item with the specified key within the collection.

## Methods

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

Adds the specified *item* in the [Items](/api/wisej.web/lists-and-grids/listview.md#items) collection to the [SelectedItems](/api/wisej.web/lists-and-grids/listview.md#selecteditems) collection.

| Parameter | Type                                                                              | Description                                                                                                                                                                              |
| --------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **item**  | [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) | The item in the [Items](/api/wisej.web/lists-and-grids/listview.md#items) collection to add to the [SelectedItems](/api/wisej.web/lists-and-grids/listview.md#selecteditems) collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The new count of selected items.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) *item* is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) *item* doesn't belongs to a different [ListView](/api/wisej.web/lists-and-grids/listview.md).

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

Clears the selection.

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

Determines whether the specified item is located in the collection.

| Parameter | Type                                                                              | Description                                                                                                        |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **item**  | [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) | The [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the specified index from the [ListViewItemCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.listviewitemcollection.md) for the [ListView](/api/wisej.web/lists-and-grids/listview.md) is an item in the collection; otherwise, false.

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

Determines if an item 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 item to search for. |

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

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

Returns an enumerator that can be used to iterate through the checked index collection.

**Returns:** [IEnumerator\<ListViewItem>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1). An [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator) that represents the checked index collection.

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

Returns the index within the [SelectedListViewItemCollection](/api/wisej.web/lists-and-grids/listview/wisej.web.listview.selectedlistviewitemcollection.md) of the specified item.

| Parameter | Type                                                                              | Description                                                                                                        |
| --------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **item**  | [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) | The [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index in the collection; otherwise, -1 if the item is not located in the collection.

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

Determines the index of an item with the specified key.

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

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index for the [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) with the specified name, if found; otherwise, -1.

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

Removes the *item* in the [Items](/api/wisej.web/lists-and-grids/listview.md#items) collection from the [SelectedItems](/api/wisej.web/lists-and-grids/listview.md#selecteditems) collection.

| Parameter | Type                                                                              | Description                                                                                                                                                                                   |
| --------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **item**  | [ListViewItem](/api/wisej.web/lists-and-grids/listview/wisej.web.listviewitem.md) | The item in the [Items](/api/wisej.web/lists-and-grids/listview.md#items) collection to remove from the [SelectedItems](/api/wisej.web/lists-and-grids/listview.md#selecteditems) collection. |


---

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