This is a migrated thread and some comments may be shown as answers.

Very slow databinding with ListBox

1 Answer 436 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Digital Man
Top achievements
Rank 2
Digital Man asked on 29 May 2007, 12:50 PM
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;

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 30 May 2007, 09:38 PM
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
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Digital Man
Top achievements
Rank 2
Answers by
Georgi
Telerik team
Share this question
or