ListViewItem.UseItemStyleForSubItems Property


Gets or sets a value indicating whether the Font, ForeColor, and BackColor properties for the item are used for all its subitems.

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

member UseItemStyleForSubItems : bool with get, set

Property Value

Type: System.Boolean

true if all subitems use the font, foreground color, and background color settings of the item; otherwise, false. The default is true.

If you do not want to have a uniform background color, foreground color, and font used for all items and subitems in your ListView control, you can set this property to false. When this property is set to true, any changes made to the subitem's ListViewItem.ListViewSubItem.Font, ListViewItem.ListViewSubItem.ForeColor, and ListViewItem.ListViewSubItem.BackColor properties are ignored, and the values of the item are used instead. You can use this property if you need to specify a different text color, background color, or font to be used for a subitem to highlight the item when subitems are displayed in the ListView control.

The following code example demonstrates how to set the UseItemStyleForSubItems property to false to define a custom style for ListViewItem.ListViewSubItem objects. The example also demonstrates how to set the ForeColor and Font properties. To run the example, paste the following code into a form and call the InitializeListView method in form's constructor or Load event-handling method.

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

.NET Framework
Available since 1.1
Return to top