My ListView have to keep the Selected
property true unless Light
and Time
value changed. (Because the ListView should remain in this state and Enabled should change to false.)
When I click outside ListView, the Selected
property stays true. But, when I click a 'not exist' row of ListView, the Selected
property doesn't stay true.
To solve this problem, I wrote a code in ListView_Click
event, but ListView_Click
event only occurs about rows with values.
What shoud I do?
CodePudding user response:
If you want to keep the selection locked to a specific item, and want to keep it highlighted no matter whether or not the form or the control has focus, do the following:
First, set listView1.HideSelection = false
.