C1ComboBox virtualization

Posted by: egor.kachiguine on 23 May 2019, 6:53 am EST

    • Post Options:
    • Link

    Posted 23 May 2019, 6:53 am EST

    Hi - I’m trying to fill a ComboBox with a large number of items (~30k or so) - and while the autocomplete is nice and snappy, the dropdown is taking forever (many minutes) to open, at least the first time. It feels to me like the virtualization isn’t on, somehow. Are there any particular gotchas to deal with here? We built out a control for similar purposes using the FlexGrid and it works just fine, this one isn’t really doing any heavier lifting - it feels like virtualization is simply off.

  • Posted 23 May 2019, 7:49 pm EST

    Hello,

    One does not need to enable Virtualization, as its already implemented by C1Combobox internally.

    Regarding the issue, what version of ComponentOne assemblies are you using? The reason behind this question is when I tried loading C1Combobox with around 56000 records using the latest version, it took only few milliseconds for the dropdown to open. So, the issue is not happening at my end. Can you run attached application and share how much time does it take at your end?

    Meanwhile, can you also share how are you passing data to the control? Data passing approach plays a major role in C1Combobox’s performance. Like adding items iteratively through the Items collection can adversely impact the performance. The best way to do this is to use a collection (like List), add items to this collection using a loop and once done, use this collection to fill C1Combobox. This way C1Combobox performance can be improved by more than 50%.

    So, to further investigate about this issue, I need information about your ComponentOne version and a stripped down version of your application showing the issue.

    Thanks,

    Ruchir

    Virtualization_C1Combobox.zip

  • Posted 24 May 2019, 6:56 am EST

    Hi Ruchir, thanks for your test example. It’s very quick for me as well, so the problem is clearly on our end somewhere. I’m not sure where that is at this point The collection is completely filled from the start, there is nothing iterative going on - that’s why the autocomplete functionality works well from the very start, and it’s just opening the drop-down opening that presents a problem.

    Originally, the source was a <class,string> dictionary with DisplayMemberPath and KeyValuePath set. Then I switched it to a list (keeping the DisplayMemberPath - but I can probably override the ToString on the class to get rid of it. Maybe that’s the problem here, though it seems like virtualization should make this a non-issue (and again, autocomplete works fine). The delay goes up linearly/incrementally with the size of the list - 1k is slow, and 30k unbearable, so it really feels like it’s rendering all the items in the dropdown. Is there something we could be doing that is defeating virtualization (like what can happen when you stick a virtualized control into another scrollview and let it grow)? For reference, here is how it’s used in xaml, no special options or styles.

            
    <c1:C1ComboBox Grid.Row="3" Grid.Column="3" IsEnabled="True" AutoComplete="True" IsEditable="False"
                ItemsSource ="{Binding SecuritiesViewSource.View}" 
                SelectedValue="{Binding SelectedSecurity, Mode=TwoWay}" 
                DisplayMemberPath="name">
                <!--<c1:C1ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel />
                    </ItemsPanelTemplate>
                </c1:C1ComboBox.ItemsPanel>-->
            </c1:C1ComboBox>
    
    

    I used to just bind the source to the collection, but switched to creating the viewsource manually just in case - no change there.

    I’m sorry, I don’t think I can snip out this part of the application into a test project, but I’ll experiment a bit more. For now I replaced it with our FlexGrid-based control, but the combobox solution would be a bit neater in this particular context.

  • Posted 28 May 2019, 4:21 pm EST

    Hello,

    I modified the application to bind C1Combobox to a Dictionary<class,string> like yours and set its DisplayMemberPath, SelectedValuePath properties but still the combobox’s performance did not degrade. See attached sample.

    Again, what ComponentOne version are you using? C1Combobox had some performance issues in the old version but the latest C1Combobox has very good performance. So, you’re requested to try running building your project using the latest assemblies that can be downloaded from here: http://prerelease.componentone.com/dotnet40/c1wpflibrary/2019-t1/C1WPFBasicLibrary.4_4.0.20191.627.zip

    Also, without looking at your application we cannot predict what you might be doing wrong and that’s causing the issue. So, even if you cannot strip down your application, can you please share the code snippets related to C1Combobox, including your DataCollection structure.

    Kind regards,

    Ruchir

    Performance_C1Combobox.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels