Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 682
Maria João Avatar asked Oct 28 '08 16:10

Maria João


People also ask

What is a list view in C#?

The ListView in C# provides an interface to display a list of items using different views including text, small images, and large images.

What is a ListView?

A list view is an adapter view that does not know the details, such as type and contents, of the views it contains. Instead list view requests views on demand from a ListAdapter as needed, such as to display new views as the user scrolls up or down. In order to display items in the list, call setAdapter(android.

What are the 4 main modes in list view control?

The control has four view modes: LargeIcon, SmallIcon, List, and Details.

What is a ListView control?

List view (ListView) controls are used to display a collection of items, each having a text label and, optionally, an icon and a check box. List view can display items in several modes - with full-sized icons or small icons, with additional information displayed in columns on the right of the item, and so on.


2 Answers

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.

like image 87
BenR Avatar answered Oct 01 '22 16:10

BenR


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

like image 28
Stu Mackellar Avatar answered Oct 01 '22 18:10

Stu Mackellar