Is it possible to make SubItem interactive in ListView

I am trying to add two coloumns to a listview for something, and another for something else, but it will not allow me to select a subitem only for the original item, anyway, to fix this without using the full row selection? I should also be able to load elements from a txt file, so datagridview will not work for this. Thanks

+4
source share
2 answers

I believe that DataGridView more suitable for what you are trying to do. Sub-items in a ListView should not be clicked individually.

+2
source

If you use the ListView structure for WindowsForms, you can assign a MouseDown event handler:

 private void listView1_MouseDown(object sender, MouseEventArgs e) { Console.Out.WriteLine("eX = {0}, eY={1}", eX, eY); } 

Here you have the point at which the mouse button is clicked in the ListView control. Now you can calculate the column index because you know the width of the everey column.

Not very convenient, but it disappears if you do not find another solution.

+2
source

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


All Articles