Click here to Skip to main content
15,889,497 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,
I have a problem with combo box that i did give hem 2000 item the combo tack 2 sec to show his list for selection
this was the code XAML :

C#
<combobox height="23" horizontalalignment="Left" margin="72,27,0,0" name="cmbTest">
     VerticalAlignment="Top" Width="120" >        
</combobox>

to fix this time delay i did use VirtualizingStackPanel ,
the code after adding VirtualizingStackPanel is:

C#
<combobox height="23" horizontalalignment="Left" margin="72,27,0,0" name="cmbTest" scrollviewer.cancontentscroll="True">
                 VerticalAlignment="Top" Width="120" > 
            <combobox.itemspanel>
                <itemspaneltemplate>
                    <virtualizingstackpanel />
                </itemspaneltemplate>
            </combobox.itemspanel>
        </combobox>




as you see i did add :
C#
<combobox.itemspanel>
    <itemspaneltemplate>
        <virtualizingstackpanel />
    </itemspaneltemplate>
</combobox.itemspanel>



now the performance problem is solved with this code,

after this i want to change the scroll behavior so i did set ScrollViewer.CanContentScroll="false" in order to change scroll behavior.

after this modification i did lose the performance ,

any one have idea to solve this , the combo item visualization be performed and kip the scroll behavior

thx for help
Posted
Updated 17-Apr-12 4:41am
v2
Comments
Nelek 17-Apr-12 10:41am    
Edit: Code tags added

So far i know, if you uncheck the CanContentScroll you will loose virtualization. For more details please have a look on that [^]
 
Share this answer
 
CSS
i did find the solution for this problem i did use this link :

http://stackoverflow.com/questions/1977929/wpf-listbox-with-a-listbox-ui-virtualization-and-scrolling/9875475?s=3b2992e5-728d-4508-a9c3-8ddb895e265a[^]

at the post that explain how to use PixelBasedScrollingBehavior class

all you need to do is to add this class in your solution and used it in the your XAMEL code
 
Share this answer
 
thanks for your help I know this , and i want an idea to work around it ,
i need the both CanContentScroll without loosing virtualization.
 
Share this answer
 
Comments
BillW33 18-Apr-12 12:07pm    
If you have a question or comment use the "Have a Question or Comment?" button at the bottom of a solution. Do not enter another question or a comment as a new solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900