Solved

virtualization of control

Posted on 2011-09-06
10
284 Views
Last Modified: 2013-11-12
Hi

I have created a listbox
<ListBox Margin="58,96,100,66"  Name="listBox1" VirtualizingStackPanel.IsVirtualizing="True" />

Open in new window


Now I am binding it from code behind
for (int i = 0; i < 1000000; i++)
{                
 listBox1.Items.Add(i.ToString());
}

Open in new window


Even I have set VirtualizingStackPanel.IsVirtualizing="True" even then why it takes a lot of time to load the list.

Please advice.

Regards
Karan Gupta
0
Comment
Question by:KaranGupta
10 Comments
 
LVL 8

Expert Comment

by:guvera
ID: 36493779
0
 
LVL 8

Expert Comment

by:databoks
ID: 36494497
How long is "long time" ?
0
 

Author Comment

by:KaranGupta
ID: 36494701
3-4 seconds. The main concern is not time, but to see how virtualization helps in improving performance.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36499226
Its a WPF question and you did not choose that zone for it!
0
 
LVL 8

Expert Comment

by:databoks
ID: 36499439
Well.. Have you tried to disable Virtualization and see how long time it takes?

0
 

Author Comment

by:KaranGupta
ID: 36500605
CodeCruiser:

I tried to search it but could not find it.

databoks:

It is taking the same time that is why I have asked this query.
0
 
LVL 28

Accepted Solution

by:
sybe earned 250 total points
ID: 36902678
So you have a listbox with 1 million options in it.

What are you measuring?
The time to send those megabytes from server to client?
The time it takes the browser render such a listbox?

Because virtualization really makes no difference for those two.

If you want to measure the server-process only you will need to time it takes to generate the code. So compare begin (right before the loop) and end time (right after the loop) on the server.

0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 250 total points
ID: 36902773
my assumption is that you are doing manual data binding and not setting the data source and then call the bind method
My assumption is that when you set the data source and do data bind then the virtualization will kick in and will only load desired set of records and not all the records at a time
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question