Very slow databinding with ListBox

2 posts, 0 answers
  1. Digital Man
    Digital Man avatar
    126 posts
    Member since:
    Nov 2003

    Posted 29 May 2007 Link to this post

    Ok, I've started to play around with the WinForms controls. Overall I like the look and feel and program interface. However databinding seems painfully slow. I created a little app to generate unique 10 character codes. I store them in an in memory DataTable and then bind them to a listbox after all the codes are added. With the regular WinForms ListBox the binding occurs almost immediately after the codes are done generating. When I set it to bind to the RadListBox instead it takes a while even for just about 1000 codes.

                DataView dvCodes = new DataView(_dtCodes, "", "UniqueCode", DataViewRowState.CurrentRows);
                lstCodes.DisplayMember = "UniqueCode";
                lstCodes.DataSource = dvCodes;
                //radListBox1.DisplayMember = "UniqueCode";
                //radListBox1.DataSource = dvCodes;
  2. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 30 May 2007 Link to this post

    Hello Dan,

    It is very hard for to beat performance of the MS listbox, especially when offering several features which are not supported by the standard control (for instance, the ability for theming, animation, image in items support, allows for different items to have different height, gradients, etc). Excellent performance is one of our main goals and we are constantly working in this direction. Hopefully we will be able to be very close to the standard control with the next major version.

    As to your case, you can accelerate binding using SuspendLayout and ResumeLayout methods like this:

                DataView dvCodes = new DataView(_dtCodes, "", "UniqueCode", DataViewRowState.CurrentRows);
                radListBox1.SuspendLayout();
                radListBox1.DataSource = dvCodes;
                radListBox1.DisplayMember = "UniqueCode";
                radListBox1.ResumeLayout(false);

    Tell us whether this solution helped to solve the performance issues.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top