HideSelection Property

ListView.HideSelection Property

 

Gets or sets a value indicating whether the selected item in the control remains highlighted when the control loses focus.

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

member HideSelection : bool with get, set

Property Value

Type: System.Boolean

true if the selected item does not appear highlighted when the control loses focus; false if the selected item still appears highlighted when the control loses focus. The default is true.

When this property is set to false, selected items in the ListView control remain highlighted in a different color than the current selection color specified by the operating system when the ListView control loses focus. You can use this property to keep items that are selected by the user visible when the user clicks a different control on the form or moves to a different window.

System_CAPS_noteNote

If you are concerned with the accessibility of your applications, it is recommended that you set the HideSelection property to false.

The following code example demonstrates a ListView that allows multiple items to be selected. The example demonstrates setting the HideSelection and HeaderStyle properties. It also demonstrates the ColumnHeader.Text, ColumnHeader.TextAlign, and ColumnHeader.Width properties. To run this example, paste the following code into a form that contains a ListView object named ListView1 and a TextBox named TextBox1. Call the InitializeListView method from the form's constructor or Load event handler.

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

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft