Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,23 @@

The following table shows an example of how the <xref:System.Windows.Forms.ListView.ListViewItemCollection> stores the items of the <xref:System.Windows.Forms.ListView> as well as their selection states in an example <xref:System.Windows.Forms.ListView> control.

|Index|Item|Selection state in the ListView|
|-----------|----------|-------------------------------------|
|0|Item1|Unselected|
|1|Item2|Selected|
|2|Item3|Unselected|
|3|Item4|Selected|
|4|Item5|Selected|
| Index | Item | Selection state in the ListView |
|-------|-------|---------------------------------|
| 0 | Item1 | Unselected |
| 1 | Item2 | Selected |
| 2 | Item3 | Unselected |
| 3 | Item4 | Selected |
| 4 | Item5 | Selected |

Based on the <xref:System.Windows.Forms.ListView.ListViewItemCollection> example in the previous table, the following table demonstrates how the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection> would appear.

|Index|Selected item in the ListViewItemCollection|
|-----------|-------------------------------------------------|
|0|Item2|
|1|Item4|
|2|Item5|
| Index | Selected item in the ListViewItemCollection |
|-------|---------------------------------------------|
| 0 | Item2 |
| 1 | Item4 |
| 2 | Item5 |

You can use the properties and methods of this class to perform a variety of tasks with the collection. The <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.Contains%2A> method enables you to determine whether an item from the <xref:System.Windows.Forms.ListView.ListViewItemCollection> class is a member of the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>. Once you know that the item is in the collection, you can use the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.IndexOf%2A> method to determine the position of the item in the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>.


You can use the properties and methods of this class to perform a variety of tasks with the collection. The <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.Contains%2A> method enables you to determine whether an item from the <xref:System.Windows.Forms.ListView.ListViewItemCollection> class is a member of the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>. Once you know that the item is in the collection, you can use the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.IndexOf%2A> method to determine the position of the item in the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>.

## Examples
The following code example demonstrates using the <xref:System.Windows.Forms.ListView.SelectedItems%2A>, <xref:System.Windows.Forms.ListView.SelectedIndexChanged> event, and <xref:System.Windows.Forms.ListView.HeaderStyle%2A> members and the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection> class. To run this example, paste the following code in a form that contains a <xref:System.Windows.Forms.ListView> object named `ListView1` and a <xref:System.Windows.Forms.TextBox> named `TextBox1`. Call the `InitializeListView` method from the form's constructor or the <xref:System.Windows.Forms.Form.Load> event handler. This example requires that the event handler is correctly associated with the <xref:System.Windows.Forms.ListView.SelectedIndexChanged> event
Expand Down Expand Up @@ -149,15 +147,8 @@
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all items from the collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
This method enables you to clear all selections from the <xref:System.Windows.Forms.ListView> control.

]]></format>
</remarks>
<summary>Clears all selections in the list view.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Contains">
Expand Down Expand Up @@ -187,7 +178,7 @@
<Parameter Name="item" Type="System.Windows.Forms.ListViewItem" />
</Parameters>
<Docs>
<param name="item">A <see cref="T:System.Windows.Forms.ListViewItem" /> representing the item to locate in the collection.</param>
<param name="item">The item to locate in the collection.</param>
<summary>Determines whether the specified item is located in the collection.</summary>
<returns>
<see langword="true" /> if the specified item is located in the collection; otherwise, <see langword="false" />.</returns>
Expand Down Expand Up @@ -231,7 +222,7 @@
<param name="key">The name of the item to find in the collection.</param>
<summary>Determines whether an item with the specified key is contained in the collection.</summary>
<returns>
<see langword="true" /> to indicate the specified item is contained in the collection; otherwise, <see langword="false" />.</returns>
<see langword="true" /> if the specified item is contained in the collection; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

Expand Down Expand Up @@ -275,7 +266,7 @@
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="dest">An <see cref="T:System.Array" /> representing the array to copy the contents of the collection to.</param>
<param name="dest">The array to copy the contents of the collection to.</param>
<param name="index">The location within the destination array to copy the items from the collection to.</param>
<summary>Copies the entire collection into an existing array at a specified location within the array.</summary>
<remarks>
Expand Down Expand Up @@ -393,9 +384,9 @@
<Parameter Name="item" Type="System.Windows.Forms.ListViewItem" />
</Parameters>
<Docs>
<param name="item">A <see cref="T:System.Windows.Forms.ListViewItem" /> representing the item to locate in the collection.</param>
<param name="item">The item to locate in the collection.</param>
<summary>Returns the index within the collection of the specified item.</summary>
<returns>The zero-based index of the item in the collection. If the item is not located in the collection, the return value is negative one (-1).</returns>
<returns>The zero-based index of the item in the collection. If the item is not located in the collection, returns -1.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

Expand Down Expand Up @@ -783,7 +774,7 @@ This member is an explicit interface member implementation. It can be used only
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="item">An object that represents the item to locate in the collection.</param>
<param name="item">The item to locate in the collection.</param>
<summary>Returns the index, within the collection, of the specified item.</summary>
<returns>The zero-based index of the item if it is in the collection; otherwise, -1</returns>
<remarks>To be added.</remarks>
Expand Down