Maria João
Maria João

Reputation: 189

List View C# stay selected

I have a list view that after a double click, a record opens a new form to show the details, but the record in the list view lost the "selection".... How do I know which record was clicked ???

Thanks

Maria João

Upvotes: 12

Views: 14461

Answers (3)

Mark Lakata
Mark Lakata

Reputation: 20907

Note that the selection will turn "gray" when focus is lost, and "blue" when focused. Keeping it blue when the focus is lost is more difficult ... you'll have to override the ListView::DrawItem

Upvotes: 4

BenR
BenR

Reputation: 12326

The listview control has a HideSelection property that defaults to True. Set this to False and the current row will remain highlighted even if the control loses focus.

Upvotes: 37

Stu Mackellar
Stu Mackellar

Reputation: 11638

Try setting the HideSelection property on the list view to false. It's enabled by default.

Upvotes: 4

Related Questions