How to time ListBox load time WPF -


i'm playing around datavirtualization , async. options have quantifying load times of listbox i'm binding virtualized data collections to?

i need way compare virtualized vs non-virtualized data loading. have been unsuccessful in locating resources topic.

should put stopwatch on listbox_loaded event in code behind?

thanks in advance!

you can use system.diagnostics.stopwatch this. make sure start before set listbox.itemssource property , stop said, in listbox.loaded event:

in xaml:

<listbox name="listbox" /> 

in code constructor:

public mainwindow() {     initializecomponent();     listbox.loaded += new routedeventhandler(listbox_loaded);     items.addrange(enumerable.range(1, 100000000));     stopwatch = new stopwatch();     stopwatch.start();     listbox.itemssource = items; } 

add handler break point after call stop stopwatch:

private void listbox_loaded(object sender, routedeventargs e) {     stopwatch.stop();     timespan elapsedtime = stopwatch.elapsed; } 

however, unless have millions of rows of data, or extremely complicated datatemplates, may not see differences. in simple example, these 100,000,000 numbers processed in under 1 second. when added larger datatemplate integers, still rendered them in on 1 second. furthermore, repeatedly running scenario return differing results, unreliable well.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -