I have an application (winforms, c#) that displays data in a Listview in a very usual way - the first row is headers, the first column in each row is header and the following sub-items is the data itself.
I want the first column (the headers columns) always visible and the horizontal scroll to affect the other columns only.
i don't think it is possible in winforms listview (am i wrong?). Hence, i'm thinking to split the listview to two listviews - one for headers and the second for data. In that case, i need to connect the vertical scroll bars - a task which i find to be harder than i've expected.
Am i taking a wrong path 开发者_Go百科(e.g. would it be easier to use a different control)? If not, any pointers on how to implement it?
Note: Winforms Listview has poor API (e.g. no scrolling event) and is known as buggy, so i'm looking a working sample rather than MSDN links...
Thanks
As already noted the DataGridView supports this behaviour, but nobody told how this will be done:
To enable this feature simply set the Frozen
property of a column. Further informations can also be found in this How to: Freeze Columns in the Windows Forms DataGridView Control.
I think you have to try to use the DatagridView instead of the listbox. As far as I know, the DataGridView supports this.
Did you try using DataGridView instead?
Edit:
In case you run into problems with setting row headers text, take a look at this post (basically, you set row header text upon item being added to grid).
精彩评论