Search code examples
c#.netwinformslistview.net-2.0

WinForms ListView.HideSelection property has no effect?


I'm working on an application in which a list view is used to select what set of data to display. When the user clicks a list item, the main view updates with the data associated with the selected item, and the ListView control loses focus. Upon losing focus, the control stops highlighting the selected item even though I've explicitly set HideSelection to false.

According to MSDN: "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."

Is this a bug, or am I missing something? We are using .NET version 2.0. (Yes, I've checked that the property isn't set anywhere outside of the designer-generated code)


Edit: Apparently the selection was highlighted, albeit very subtly. After looking through the list of properties I don't see a way to change the highlighting color when the control doesn't have focus. Any ideas? Thanks.


Solution

  • Are you sure it isn't just really, really hard to see. On my screen the difference is white vs "really really pale grey" - very subtle. It is more obvious if you change the ListView's background colour while you investigate (also, try turning down your VDU brightness).

    Shown below; the "def" is actually selected.

    No, really it is