2012-05-14

Some flashbacks on WP7 Pivot/Panorama/WebBrowser problems

Completely by accident, I just stumbled upon:

http://www.scottlogic.co.uk/blog/colin/2011/11/suppressing-zoom-and-scroll-interactions-in-the-windows-phone-7-browser-control/

Colin - Thanks for credit! And for talking more on the topic. I've never had enough time to describe a more-full solution than that one lenghy post. A user asked me recently about the code, and, of course, I shamefully still lack the time, so I'll give him link to your article.

If somebody is interested in, my original post Colin refers to is: http://stackoverflow.com/a/7347448/717732 and I also recommend to you to read another one http://stackoverflow.com/a/7391698/717732 as it also contains few bits.

At that time, I wrote quite a few posts related to WebBrowser and Pivot/Panorama on WP7, but that one is the most complete - but still, it is not complete.

I really regret I have not written in full about it at that time. I remember I did a lot of research on what is and what is not possible, and how to achieve useful effects. I realize that even at 7.5 it is still an issue, but unfortunatelly, I cannot currently provide you with my original code and ready-to-use components, because .. it is a part of published application ('OnetNews') and the last time I spoke about it, its owner was too happy about such idea of sharing the code..

BTW. I've just remembered a very important note: the WebBrowser control on WP7.0/7.1/7.5 seems to have a serious memory leak, that manifests rarely, but (almost) deterministically if your application meets certain criteria. For example, I've noticed that one of such case is .. putting few WebBrowsers across a few Panorama pages and dynamically changing their URI/Source upon swiping the Panorama's pages. I failed at pinpointing what exactly is the problem. It seems to be some race condition that causes loss of even few megabytes of memory per wipe-and-uri-reload. For a medium-sized application, it means that your application may crash afrer 14-30 page swipes. Also, be careful with images you place or link to - I remember I could easily whole application by navigating the WebBrowser to a page that displayed some large photos (frankly, all images seemed to be GC'ed properly by the WebBrowser - if only the app didn't crash).

If I manage to find time and my old notes, I'll try to post more info, but again I can't promise when it will be :|