Over a million developers have joined DZone.

Windows Phone WebBrowser Control: Suppress Zoom and Scroll

DZone's Guide to

Windows Phone WebBrowser Control: Suppress Zoom and Scroll

· Mobile Zone ·
Free Resource

Why would you ever want to suppress zoom and scroll?  Well, the WebBrowser control lets you view websites within the context of a non-browser application so that you don't end up opening the browser when you just want to peek at something.  In these cases, you may want to stop the user from zooming or scrolling if the whole page is displayed.

Colin Eberhardt shows in his blog post that there is a way to suppress zoom and scroll with HTML5, but he doesn't like that it lets you do both of these things and only snaps back.  He instead finds a solution through the .NET Wrapper - the PanZoomController:

If you inspect the visual tree of the WebBrowser control you will find that it is assembled as follows:

          \-Border (*)

(visual tree dump generated via the oh-so-useful Linq to VisualTree utility!)

You can check out Colin's blog to see the utility class he made with the help of PanZoomController to fully supress zoom and scroll.

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


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}