ListView slow and max width
See original GitHub issueListView becomes slow when it contains many columns, even if only a few of them are displayed. Here is a sample code that illustrates the issue. When you try to scroll it, it takes a long time to repaint. Virtual mode does not help. I am not really sure why it takes so long to paint 120 cells.
Private ListView1 As New ListView With {.Size = New Size(300, 400)}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Const columns = 600
Controls.Add(ListView1)
With ListView1
.BeginUpdate()
.View = View.Details
.HeaderStyle = ColumnHeaderStyle.Nonclickable
For c = 1 To columns
.Columns.Add(c.ToString, 50, HorizontalAlignment.Center)
Next
For r = 1 To 20
Dim l As New ListViewItem(r & "1")
For c = 2 To columns
l.SubItems.Add(r & c)
Next
.Items.Add(l)
Next
.EndUpdate()
End With
End Sub
Another issue I found is that it looks like there is a limitation of how large the width of all columns can be, i. e. in my sample code you can change the column count to 700 and observe how the last columns will not be visible. The last ones that will be visible will not allow you to change their width.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
WPF ListView very poor performance with large data
The problem entirely disappears as soon as I set the MaxHeight of the ListView to something bigger than it needs.
Read more >ListView and GridView UI optimization - UWP applications
Improve ListView and GridView performance and startup time through UI virtualization, element reduction, and progressive updating of items.
Read more >Optimizing Listview performance
Hello, I'm currently working on a project (which I inherited) where I'm using a listview to display setting screens.
Read more >Adding Items is slow with ListView - AutoHotkey Community
I'm expecting up to a few thousand items (MAX) being populated, and the speed is going to be a limiting factor for end...
Read more >Slow rendering of GridView with 60 elements x 3 checkboxes
I'm investigating why / how to improve the rendering speed of a rather complex UserControl / Window The Window contains a Tab-Control where ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@riov For the columns rendering, the behavior is the same in .NET Framework. For the scroll/repaint I couldn’t see any problem. For the resize issue, I believe it’s a limitation in the Windows message. Consider
WM_MOUSEMOVE, thelParamparameter determines the mouse position. The low-order word specifies the x-coordinate and the high-order word specifies the y-coordinate of the cursor. Using 16 bit for x and 16 bit for y means it can not handle coordinates larger that 32767. That’s why if you create a lot of columns, for the right most columns (which their x-coordinate is larger that 32767) you cannot change the column size, the column even do not get highlighted by mouse. If you take a look atWM_MOUSEMOVEmessage using spy++, you will see negative x-coordinate for them.Could you please raise separate issues for each one, thank you. Because both of these suggestions affect public API we’ll need to have an assessment how these changes will affect existing consumers.
Not sure, it could be an underlying limitation of Win32 API… A Windows Explorer struggles to scroll when one has beyond certain number of files in a folder too.