Hello Richard,
When you refer to
"memory issues" I believe you mean
"high memory consumption" not
"memory leaks"?
My theory why removing the
StackPanel fixed your issues is the following.
Putting a virtualization control (
ListBox,
RadDataBoundListBox etc.) inside a
StackPanel is not recommended. Before rendering, in its
Measure pass, the
StackPanel measures its children (ex. the
ListBox in your scenario) with
Infinity. That's basically saying to the
ListBox:
- "Here, take all the space in the world you need".
If a ListBox (or any other control that supports virtualization) is given infinite amount of space to render, it will
realize (create) all of its children. And the key to a successful virtualized control is:
"Do not create more children than you have to" :).
To finish off, the rule of thumb when dealing with virtualization is:
Do not put a virtualization control inside a panel that measures its children with Inifiny (StackPanel, Grid.Row with Height=Auto and Grid.Column with Width=Auto (when virtualizing horizontally)).
Kind regards,
Kiril Stanoev
the Telerik team