This is a migrated thread and some comments may be shown as answers.

SlideView containing listboxes

3 Answers 59 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 29 Jul 2012, 07:32 PM
Hi,

Been trying to use the SlideView control with a listbox held within ItemTemplate/DataTemplate combination, however I'm running into serious memory issues as a result. I also can't seem to vertically scroll the listbox either, it does react however the scrolling is inverted, so starting to wonder whether the SlideView control is really designed for what I'm doing.

The Listbox does contain 20-40 image-heavy items. I'm effectively trying to create a non-looping headerless pivot control. The SlideView has a total of 9 "pages".

If this should technically work, then I can try and put together a sample project that demonstrates the issue.

Any help would be greatefully received. Thank you.
Richard

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 30 Jul 2012, 11:12 PM
So after spending some time preparing an example, I discovered the issue. I had included a <stackpanel> container within the <DataTemplate> that held the listbox. As soon as I removed this, my memory issues stopped and the listbox scrolling started working as designed.

Still not sure what was going on, but pleased that the problem has been resolved.

Thanks,
Richard
0
Kiril Stanoev
Telerik team
answered on 31 Jul 2012, 08:11 AM
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

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Richard
Top achievements
Rank 1
answered on 31 Jul 2012, 11:02 AM
Hi Kiril,

Thank you for taking the time to post some explanation on what was happening. As you say, the issue was high memory consumption - I was topping out at 120mb and then crashing.

The theory sounds absolutely right and explains why it looked like the listbox was inverted - what I was seeing was the elastic end stops operating on a listbox that didn't have a scrollbar (because of the stackpanel).

Hopefully this post series will help others who make the same (foolish) mistake that I made!

Regards,
Richard
Tags
SlideView
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or