# On UI Virtualization article

**URL:** https://forum.kirupa.com/t/on-ui-virtualization-article/251467
**Category:** programming
**Created:** [February 8, 2008, 7:51pm UTC](https://forum.kirupa.com/t/on-ui-virtualization-article/251467 "2008-02-08T19:51:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![franxico](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@franxico](https://forum.kirupa.com/u/franxico)
#### Post date: [February 8, 2008, 7:51pm UTC](https://forum.kirupa.com/t/on-ui-virtualization-article/251467/1 "2008-02-08T19:51:26Z")

</div>

Hello, first of all kudos, for the article. It was of invaluable help to me.

I needed to implement a listbox that was binded to an observable collection of Xml Nodes.  
Each node should be parsed and rendered as text on each listbox’s item.  
The nodes were parsed out of big .xml log files (some with hundreds of Mb), so whenever the app loaded the xml, it freezed intensively.

I decided this was unacceptable and found out about data and ui virtualization, and also your article. I implemented my solution as sugested (the essential code is bellow) .

However, after a while, when playing with the scroll, i found out that each line was growing with repeated entries. For instance,

what starts like this  
Date1-event  
Date2-event  
Date3-event  
Date4-event  
Date5-event  
Date6-event

after some intensive scrolling goes

Date1Date1Date1-event  
Date2Date2-event  
Date3Date3-event  
Date4Date4-event  
Date5Date5-event  
Date6-event

Any ideas on this ?

// C# ////  
XmlLinesCollection xmlLines = (XmlLinesCollection)((ObjectDataProvider)ls.TryFindResource(“XmlLinesSource”)).ObjectInstance;  
if (xmlLines != null){

```
                xmlLines.LoadLines( fileInfo.FullName );
                if (xmlLines.Count != 0)
                    listbox.ScrollIntoView(xmlLines[0]);

            }

```

// Xaml /////////  
\<ItemsPanelTemplate x:Key=“VirtualPanel”\>  
\<VirtualizingStackPanel IsVirtualizing=“True”/\>  
\</ItemsPanelTemplate\>

\<ListBox  
x:Name=“listbox”  
ItemsPanel="{DynamicResource VirtualPanel}"  
ItemsSource="{Binding Mode=OneWay, Source={StaticResource XmlLinesSource}}"  
ItemTemplateSelector="{StaticResource xmlNodeSel}"  
/\>
