Winforms listview - make the first column always visible?

I have an application (winforms, C #) that displays data in Listview in the usual way - the first row is the header, the first column in each row is the header, and the next sub-elements are the data itself.

I want the first column (header columns) to always be visible, and horizontal scrolling only affects the other columns.

I do not think that this is possible in winforms listview (am I mistaken?). Therefore, I am going to split the list into two lists β€” one for the headers and one for the data. In this case, I need to connect vertical scrollbars - a task that I find more difficult than I expected.

Am I accepting the wrong way (for example, would it be easier to use another control)? If not, pointers on how to implement it?

Note: Winforms Listview has a poor API (for example, without scrolling) and is known as a buggy, so I am looking for a working sample, not MSDN links ...

thanks

+6
source share
3 answers

As already noted, the DataGridView supports this behavior, but no one has said how this will be done:

To enable this feature, simply set the Frozen property for the column. For more information, see How to Lock Columns in a Windows Forms DataGridView Control .

+7
source

Have you tried DataGridView instead?

Edit:

If you are having trouble adjusting the text for the row headers, take a look at this post (basically you set the text for the row headers when adding an element to the grid).

+1
source

I think you need to try using a DatagridView instead of a list. As far as I know, DataGridView supports this.

+1
source

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


All Articles