RadListView - performance and updating the GUI

4 posts, 0 answers
  1. Steve
    Steve avatar
    17 posts
    Member since:
    Oct 2014

    Posted 11 May 2015 Link to this post


    we're developing a WinForms application with Telerik Controls (or rather update an older application of ours). In this app, we use different ListViews and we often encounter performance issues. We've found workarounds and performance improvements for the lower thousands (adding up to ~2000 items), which is fine, but there can be cases when the app need to load 10k items. It's not the normal case but it can happen every so often.

    Now the improvements we made (e.g. using AddRange instead of Add) are still noticeable here, but it still takes about the ListView about 90 sec to load 9k items (with a small icon and text). That in and of itself is not the problem - sometimes it takes time to load so many items and since this an administration tool, we think our users could handle that.

    The problem is that this is happening (or at least it seems so) when the ListView is rendering the items. That means it happens on the UI thread, which on the other hand means the app is not responding while the ListView is loading. Now that is something that needs to fixed, since I don't think that it is possible to lower the loading time to an unnoticeable level. I already tried to make the method asynchronous (public async void...) and use the await keyword but there are many complications if the user resumes to click around in the application. We'd have to make many architectural changes to make this work properly and that would cost too much time.

    Is there any way to inform the user that the ListView is still loading without breaking the UI? Animated loading symbols would be fine but since the UI thread is blocked in this case, this wouldn't help much either. Any ideas?

    Thanks and regards,


    PS: For reference, at the moment we load the ListView items like this, which seems to be the fastest way (we found):

    01.            this.listViewGroup.Items.AddRange(__result.Select(
    02.                groupResult =>
    03.                {
    04.                    var __lvdi = new ListViewDataItem();
    06.                    //Do some work to transform the groupResult item into a ListViewDataItem
    07.​                           //This takes almost no time at all (a fraction of a second)
    09.                    return __lvdi;
    10.                }).ToArray());

  2. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 11 May 2015 Link to this post

    You should use BeginUpdate before removing and adding new items and EndUpdate after you are done. That way the  listview is not updating for every item added.
  3. DevCraft R3 2016 release webinar banner
  4. Steve
    Steve avatar
    17 posts
    Member since:
    Oct 2014

    Posted 11 May 2015 in reply to Hugues Link to this post

    Already tried that approach, sadly there seems to be no noticeable difference in perfomance.
  5. Dimitar
    Dimitar avatar
    1326 posts

    Posted 12 May 2015 Link to this post

    Hi Steve,

    Thank you for writing. 

    I want to mention that Hughes is correct and you should enclose the items adding within a Begin/End update block. I have tested this and adding 9000 items takes less than a 100 milliseconds on my side (see the attached video). So there must be something else that is causing such delay on your side. This is why I want to kindly ask you to send us the entire code that is used for the items creation. 

    Perhaps better approach would be to create a separate method that prepares all the data for the items (since this operation is not connected with the UI it can be executed on a separate thread). Once the data is ready you can create and add the items which would not take much time. Here is the code I have used for the test:
    private void radButton1_Click(object sender, EventArgs e)
        Stopwatch sw = new Stopwatch();
    void AddItems(int count)
        Image img = Image.FromFile(@"C:\img\delete.png");
        for (int i = 0; i < count; i++)
            radListView1.Items.Add(new ListViewDataItem("Item " + i) { Image = img });

    I am looking forward to your reply.


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top