0

I am currently developing a Windows Phone 8 app and I have several questions about LongListSelector item recycling.

I my home page, I have 2 lists of 50 items. Each item is composed from :

  • 1 temporary image loaded from Assets ;
  • 1 image retrieved from the web ;
  • 1 text.

When I display these 2 lists, the app crash because of OutOfMemoryException. My application needs more than the 150Mo it can have.

My first question is about the temporary image. What is the best way to implement this functionality ? Currently, I have 2 images at the same place and when the "real" image is loaded, it displays ON the temporary image and not at the place of. The consequence is that I have 2 images controls. I guess that it is not the best way to improve performance and memory leaking.

The second question is about the recycling. How can I load only the images that are displaying. I have try several things like put wrap the image control into a userControl and set the image control source to null into the Unload event but when I scroll to the first item to the last than to the last from the first one, the event method is called only once... so the memory is not released...

I am using the MVVM pattern to bind the source of the image controls.

Do you have a proper example that show how to correctly manage a LongListSelector of items that contain images ?

Thank you in advance for your tips !

rolandl
  • 1,769
  • 1
  • 25
  • 48

1 Answers1

0

Some suggestions. For a image control with a placeholder, try using the SuperImage control from the Coding4Fun toolkit! How to use it is detailed here

Secondly to clear out image memory usage, there is a good suggested solution by KooKiz given here, basically it will clear used memory when the image is unloaded.

Hope this helps...

Community
  • 1
  • 1
Depechie
  • 6,102
  • 24
  • 46