Solved

virtualization of control

Posted on 2011-09-06
10
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

688 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