I have a question about bitmap caching in windows phone 7 silverlight applications.
When shall i use it? And on what controlls? Should i bitmap cache children of a controll thats bitmap cached? I'm not sure how its works and it would be nice to get some advice from you guys.
/Richard
BitmapCache should, for the large majority of objects, be something you don't need to think about on Windows Phone 7. Silverlight for WP7 implements automatic bitmap caching of elements that are animating in ways that caching helps (translate, opacity, rotate - maybe more, I can't recall now).
Silverlight on a desktop PC (or Mac) isn't quite as smart currently, so you need to manually specify CacheMode=BitmapCache on objects using roughly the guidance pointed to by Praetorian in his answer.
There are probably edge cases where setting BitmapCache explicitly is useful even on Windows Phone, but I don't know about them offhand. You could try looking at the Windows Phone Performance Tips on MSDN.
I found this link explaining
CacheMode
in Silverlight 3. From the link: [This link is dead.]<param name="EnableCacheVisualization" value="true" />
I wonder if the
EnableCacheVisualization
can be enabled for WP7, I'm usingBitmapCache
for aLongListPicker
and aContentPresenter
(that I populate with dynamically created content) and it'd be interesting to know if the caching is working. But according to the 3rd bullet, you should be using it only if you're animatingUIElement
s, which I'm not, so maybe I shouldn't be using it at all!From what i've seen/read, you want to use bitmap caching on objects that might be expensive to render (like lots of children or complicated layout) if you are going to use them in transitions or animations.
With bitmap caching, the hardware can do the transitions+animations faster/smoother.
I think you just need to put it on the top most item/parent item where you apply the transform or animation? Someone will be along shortly to correct me, i'm sure :)