i wrote an app to collect book data and put it into a listview in NET 8 C# on Winforms (picture below). My listview has around 19 columns at start but will expand to about 50 – 70 when working with the data. Some of the colums are colored. I do experience now poor performance of the listview control when more data will be placed (like about 100 list entries). The issue results in flickering when scrolling. While i could solve the issue of vertical flickering by adding code to activate double buffering (i dont know if that is for use but i put the code below) the flickering when scrolling horizontal remains. And its not just the flickering. Moving the slider feels slow as the columns and its entries are redrawn when moving the slider. Its not visible with 1-5 list entries but it starts with about 10-15 and gets worse the more entries i put into the list. I read that the Winforms listview redraws its entire contents even on small changes. The horizontal scrollbar gets active automatically but i cant get any access to it. Does somebopdy know what i can do to at least reduce the slow movement? It would already be something if i could get access to the horizontal scrollbar of the listview control.
public static class ControlExtensions
{
public static void SetDoubleBuffered(this System.Windows.Forms.ListView listView, bool doubleBuffered = true)
{
listView.GetType()
.GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!
.SetValue(listView, doubleBuffered, null);
}
}