Virtualizing + FlipView recycling issue

The Featured Discussion Board Post this week is Virtualizing +FlipView recycling problem started by Lee McPherson

Lee is trying to get a preview of a list of images from a zip or rar archive that contains jpeg files from a Windows Phone application. He is facing a problem with the virtualization from the VirtualizingStackPanel inside the FlipView. The pictures show fine the first times but on repeated flips, they seem to show up out of order.

With further investigations, Lee is able to narrow the problem to the internal scrollviewer snapping in the VirtualizingStackPanel. Even replacing the FlipView with an ItemsControl does not help. Lee works around this issue which shows only in WP8, while it works fine in WinRT and 8.1.

Lee credits this workaround to countering some memory management issues. Oliver Ulm expresses curiosity regarding this, to which Lee explains that it was an issue in WP8 with disposing of BitmapImage. This memory was not set free immediately, even when set to null or when GC.Collect was called, which resulted in memory issues when several large images were loaded and unloaded in quick succession. Lee used the workaround to set the source of an already opened BitmapImage with a 1×1 pixel png file to force the major chunk of memory release.

This discussion was selected for featuring because it highlights how innovative ideas lead to overcoming difficult situations when developing apps.

Keep those interesting questions coming!