Poor performance when binding to dataset

7 posts, 0 answers
  1. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 05 Mar 2010 Link to this post

     

     

    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; 

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Mar 2010 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Mar 2010 Link to this post

    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.
  5. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 05 Mar 2010 Link to this post

    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
  6. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Mar 2010 Link to this post

    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.
  7. OverCoded
    OverCoded avatar
    34 posts
    Member since:
    Mar 2010

    Posted 11 Nov 2010 Link to this post

    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.
  8. George
    Admin
    George avatar
    1332 posts

    Posted 17 Nov 2010 Link to this post

    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>>
Back to Top
UI for WPF is Visual Studio 2017 Ready