Gets or sets a value indicating whether a check box appears next to each item in the control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The View property is set to View.Details) that the user can select by clicking the check box. The property offers a way to select multiple items in the ListView control without using the CTRL key. Depending on your application, using check boxes to select items rather than the standard multiple selection method may be easier for the user. Even if the MultiSelect property of the ListView control is set to false, you can still display checkboxes and provide multiple selection capabilities to the user. This feature can be useful if you do not want multiple items to be selected yet still want to allow the user to choose multiple items from the list to perform an operation within your application.property allows you to display a check box next to each item in the list. This enables your application to display a list of items (and subitems if the
To determine when an item has been checked, create an event handler for the ItemCheck event. To get all the items that are checked in the ListView, use the CheckedItems property to access the ListView.CheckedIndexCollection for the control. To get the indexes of all items that are checked in the ListView, use the CheckedIndices property.
If an ImageList is specified in the StateImageList property, the images at index positions 0 and 1 in the ImageList are displayed instead of the check box. The image at index position 0 is displayed instead of the unchecked check box, and the image at index position 1 is displayed instead of the checked check box.
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.
This example requires that you have added the code to a Form and call the method created in the example from the constructor or another method on the form. The example also requires that images named MySmallImage1, MySmallImage2, MyLargeImage1, and MyLargeImage2 are located in the root directory of drive C.
Available since 1.1