ListViewItem.ListViewSubItem Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Represents a subitem of a ListViewItem.

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


type ListViewSubItem = class end


Initializes a new instance of the ListViewItem.ListViewSubItem class with default values.

System_CAPS_pubmethodListViewItem.ListViewSubItem(ListViewItem, String)

Initializes a new instance of the ListViewItem.ListViewSubItem class with the specified owner and text.

System_CAPS_pubmethodListViewItem.ListViewSubItem(ListViewItem, String, Color, Color, Font)

Initializes a new instance of the ListViewItem.ListViewSubItem class with the specified owner, text, foreground color, background color, and font values.


Gets or sets the background color of the subitem's text.


Gets the bounding rectangle of the ListViewItem.ListViewSubItem.


Gets or sets the font of the text displayed by the subitem.


Gets or sets the foreground color of the subitem's text.


Gets or sets the name of the ListViewItem.ListViewSubItem.


Gets or sets an object that contains data about the ListViewItem.ListViewSubItem.


Gets or sets the text of the subitem.


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


Resets the styles applied to the subitem to the default font and colors.


Returns a string that represents the current object.(Overrides Object.ToString().)

A ListView control displays a list of items that are defined by the ListViewItem class. Each ListViewItem can store subitem objects that are defined by the ListViewItem.ListViewSubItem class. Subitems are displayed when the View property of the ListView control is set to Details. Typically, subitems contain information that is related to their parent item. For example, if a ListView control displays items that represent orders, each item could display the order number. Subitems could be added to each item to display information such as the product ordered, the quantity of items ordered, and the total price of the items ordered. Unlike ListViewItem objects, ListViewItem.ListViewSubItem objects cannot be edited directly by the user (the user can edit ListViewItem objects if the LabelEdit property of the ListView control is set to true).

Because subitems cannot be directly edited by the user and do not display images, properties are limited to those that affect the style of the subitem text when it is displayed in the ListView control. If the UseItemStyleForSubItems property of the ListView that contains the subitems is set to false, you can use the Font, BackColor, and ForeColor properties to change the styles applied to the text display. Typically, the styles of the item and the subitems are the same in a ListView control, but if you want to change the style of a specific ListViewItem.ListViewSubItem to highlight it, you can use these properties on the items you want to display differently.

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

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top