ListView List Element in winform

I want to select an item in a ListView when clicked. I also want to know what I clicked. I am working on winforms with C #. I also want to know how can I click on the entire line?

+6
source share
2 answers

Just handle the Click event in the list and use the ListView.SelectedItems property to select which items are selected:

 private void listView1_Click(object sender, EventArgs e) { var firstSelectedItem = listView1.SelectedItems[0]; } 
+7
source

also, if you use xaml for the window, you must add the MouseUp = "listView1_Click" attribute to the ListView tag

0
source

Source: https://habr.com/ru/post/888525/


All Articles