qqilihq
qqilihq

Reputation: 11494

Caching of displayed images in Silverlight/Windows Phone app

My app shows a list (LongListSelector to be precise) with text and Images. For the images, I currently bind the Source attribute to an HTTP URL provided by the model class, which works without problems. However, I am now asking myself, if this strategy is generally advisable with regards to data transfer:

  1. Does the framework perform any caching of the downloaded images?
  2. If so, how about the scope of the caching? (runtime of the app, or even longer?)
  3. If not, is there any existing mechanism, pattern or recommendation, on how to perform caching in such a case?

Upvotes: 0

Views: 300

Answers (1)

Artem Zinnatullin
Artem Zinnatullin

Reputation: 4447

  1. Framework performs only caching in memory, so after app restart cache will be cleared
  2. runtime only

  3. I have got a solution for you. It is JetImageLoader, I created it for application, where we need to load, cache and show big amount of logos, icons and so on.

It can be used as binding converter, so you should not even change your code! Just update your XAMLs!

Please, check out samples in repository, you'll love it ;)

Features:

  • Caching on disk
  • Caching in memory
  • Fully asynchronous
  • Available as binding converter or programmatically from your code
  • Fully open source, fork and improve it!

Here is the example:

<Image Source="{Binding ImageUrl, Converter={StaticResource MyAppJetImageLoaderConverter}}"/>

P.S. I am sorry, that I copying my answer from another questions, but image caching on windows phone is huge problem and I want to share my solution, so everybody can use it and improve for developers community

Upvotes: 1

Related Questions