开发者

Prevent Scrolling in IE on Windows Phone 7

Is there any way to prevent the user from scrolling the contents of a WebBrowser control in a Windows Phone 7 application, but still allowing them to interact with the contents (c开发者_JAVA技巧lick buttons, check checkboxes, etc.)

Thanks


It is possible, you can do the following:

  • Locate the Border element within the WebBrowser that captures touch events and forwards them to thw native browser control.
  • Detect scroll interactions and cancel these events.

I have created a simple utility class that performs this and blogged about it here:

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

To disable scrolling do the following:

var browserHelper = new WebBrowserHelper(webBrowser);
browserHelper.ScrollEnabled= false;


If you use meta tags to fix the zoom (<meta name="viewport" content="user-scalable=no" /> ), then you can probably use javascript to fix the scroll position - but overall I suspect this won't look very nice.

Can you tell us a bit more about what effect you are looking for? e.g. If you're trying to use scroll position to control what content is visible, then you might be better off using javascript to dynamically choose which elements are visible instead - e.g. using jquery to show/hide content.


Talked to the IE team at Microsoft, this isn't possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜