I am trying to achieve a list of images (much like the Pictures hub) from a zip or rar archive containing jpg files in a WP8 universal app. I've already got a so-so solution using a custom control in a Silverlight app, but I wanted to try the FlipView to get much nicer animations (scrolling, snapping, snap-back). However, I'm seeing a big problem with the virtualization from the VirtualizingStackPanel inside the FlipView.
The ItemsSource property of the FlipView is bound to a List of custom class type VirtualizedItem. My VirtualizedItem contains an ImageSource get accessor that extracts an image from an archive (rar file) and loads it to a BitmapImage with screen-width dimensions. I've got the CleanUpVirtualizedItemEvent setup to clear the ImageSource when the item is revirtualized. This should work...
And it does seem to be working in terms of memory requirements. I can flip through the images and get to the end of my list of 30 or so images. However, there is something wrong with the virtualization. If I flip back and forth a few times, eventually one of the images will show up out of order. What seems to be happening is this:
Let's say that the current unvirtualized items are #3, #4, and #5. If I flip forward, then backwards, sometimes image #6 will show up where image #3 should be. It seems that the flip forward virtualizes #3 and starts the load for image #6, but the quick flip back causes that image load for #6 to show up back at #3 which has been newly unvirtualized.
Any suggestions on how I should fix this problem?