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

Poor performance when binding to dataset

6 Answers 197 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Cameron Molyneux
Top achievements
Rank 1
Cameron Molyneux asked on 05 Mar 2010, 01:33 PM

 

 

I seem to be having severe performance issues when binding to data sets

I have a query that returns a dataset of SNOMED codes.  There are approximately 2000 codes (this is just a sub set)

when i try to bind to the dataset it takes 15 seconds plus to perform the bind

I have virtualised the combo box and when i try to drop down its reall fast but with the following code added my control takes 15+ seconds to load ... when i take this code out its sub 1 second to display the user control

is there anything I can do

 

            // set up the snomed combo box  
            cboSnomed.ItemsSource = snomedDataset.Tables[0].DefaultView;  
            cboSnomed.DisplayMemberPath = "Code";  
            cboSnomed.SelectedValuePath = "Id";  
            cboSnomed.SelectedValue = -1; 

6 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 05 Mar 2010, 01:41 PM
Hello Cameron,

You need to change the ItemsPanel of RadComboBox to VirtualizingStackPanel:
<telerik:RadComboBox ...>
    <telerik:RadComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel />
        </ItemsPanelTemplate>
    </telerik:RadComboBox.ItemsPanel>
</telerik:RadComboBox>

Kind regards,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Valeri Hristov
Telerik team
answered on 05 Mar 2010, 01:44 PM
Opps, I didn't see that you already virtualized the control. So with virtualization and the code from your ticket RadComboBox needs 15 seconds to load, right? This is really strange, could you please, open a new support ticket and send me a simple application that can be used to observe the problem? I will respond with a suggestion ASAP.

Best wishes,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Cameron Molyneux
Top achievements
Rank 1
answered on 05 Mar 2010, 01:54 PM
Its very difficult to create a sample project as all of our data access is wrapped in in assemblies that access a 'intersystems cache' database

here are the two snippets of code that are of interest .. this is the code in my control that creates the combo box

<telerik:RadComboBox x:Name="cboSnomed" Margin="1" Grid.Column="1" IsEditable="True" Grid.Row="2">  
                <telerik:RadComboBox.ItemsPanel> 
                    <ItemsPanelTemplate> 
                        <VirtualizingStackPanel /> 
                    </ItemsPanelTemplate> 
                    </telerik:RadComboBox.ItemsPanel> 
                </telerik:RadComboBox> 
 

and this is the code i use to bind to a dataset that is passed into the control as a property.

We really want to get away from datasets but our legacy system returns them so we have to use them at the moment


            // set up the snomed combo box  
            cboSnomed.ItemsSource = snomedDataset.Tables[0].DefaultView;  
            cboSnomed.DisplayMemberPath = "Code";  
            cboSnomed.SelectedValuePath = "Id";  
            cboSnomed.SelectedValue = -1; 


The dataset has about 2000 items in it
0
Valeri Hristov
Telerik team
answered on 05 Mar 2010, 02:25 PM
Hi Cameron,

Is it possible that the data access is making the delay? If it is not asynchronous, the UI will freeze when the call to the database is in progress. I suppose that the DataSet is making its database calls through the UI thread, hence the loading delay.

You could try to start a new thread, where you should enumerate the snomedDataset.Tables[0].DefaultView and when the enumeration completes (I think that a simple foreach cycle will be sufficient) you set the ItemsSource of RadComboBox. This way the database call will be made in the background and RadComboBox will be empty until the thread finishes its job.

Greetings,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
OverCoded
Top achievements
Rank 2
answered on 11 Nov 2010, 04:23 PM
All I get with using the Virtualization stack panel is "Items Collection must be empty before using ItemsSource." Providing an empty list will make it a lot faster but I really need the user to be able to chose from something. So when do I bind the data? I get this error no mater when I bind it.
0
George
Telerik team
answered on 17 Nov 2010, 09:13 AM
Hello,

In general, you could get this message because you are trying to bind to the ItemsSource property and you have hard coded some items in your XAML. You can do one or the other, but not both. 
I hope this helps.

Kind regards,
George
the Telerik team
See What's New in RadControls for WPF in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
Tags
ComboBox
Asked by
Cameron Molyneux
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Cameron Molyneux
Top achievements
Rank 1
OverCoded
Top achievements
Rank 2
George
Telerik team
Share this question
or