ListViewItem.Checked Property

 

Gets or sets a value indicating whether the item is checked.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member Checked : bool with get, set

Property Value

Type: System.Boolean

true if the item is checked; otherwise, false. The default is false.

This property is useful only if the CheckBoxes property of the ListView control the item is contained in is set to true. You can use this property to determine if the item has been checked by the user or through code at run time. To determine all the items that are checked in a ListView control, you can use the CheckedItems property. To take action when an item has been checked, you can create an event handler for the ItemCheck property of the ListView control.

The following code example creates a ListView control with three ListViewItem objects specified and three ListViewItem.ListViewSubItem objects specified for each item. The example also creates ColumnHeader objects to display the subitems in details view. Two ImageList objects are also created in the code example to provide images for the ListViewItem objects. These ImageList objects are added to the LargeImageList and SmallImageList properties. The example uses the following properties in creating the ListView control:

You need to add the code to a Form and call the method created in the example from the constructor or another method on the form. The example requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: