WebBrowser 阻止 PivotControl 中的滑动

发布于 2024-10-19 16:04:45 字数 688 浏览 1 评论 0原文

我的应用程序和一些pivotItems WebBrowser 中有PivotControl。 我注意到 WebBrowser 会阻止滑动到下一个枢轴。我不确定这是否可以,因为 其他枢轴可以滑动,而带有 WebBrowser 的枢轴则不能,这可能会造成混乱。这是 行为正确吗?有办法解决这个问题吗? (也许是小技巧)

这是我的 xaml 代码:

<controls:Pivot Title="MY PIVOT">
    <controls:PivotItem Header="first">
        <TextBlock Text="First Pivot" />
    </controls:PivotItem> 
    <controls:PivotItem Header="second">
        <TextBlock Text="Second Pivot" />
    </controls:PivotItem>       
    <controls:PivotItem Header="third">
        <phone:WebBrowser Source="http://www.stackoverflow.com" />
    </controls:PivotItem>
</controls:Pivot>

I have PivotControl in my application and in some of pivotItems WebBrowser.
I noticed that WebBrowser blocks sliding to next pivots. I'm not sure if this is ok, because
other pivots slides and that one with WebBrowser doesn't, and that can be confusing. Is this
behavior correct? Is there way to solve this? (maybe little hack)

here is my xaml code:

<controls:Pivot Title="MY PIVOT">
    <controls:PivotItem Header="first">
        <TextBlock Text="First Pivot" />
    </controls:PivotItem> 
    <controls:PivotItem Header="second">
        <TextBlock Text="Second Pivot" />
    </controls:PivotItem>       
    <controls:PivotItem Header="third">
        <phone:WebBrowser Source="http://www.stackoverflow.com" />
    </controls:PivotItem>
</controls:Pivot>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

几味少女 2024-10-26 16:04:45

这是正确的行为。

WebBrowser 这样做是为了启用网页的水平滚动。

这就是为什么不建议将此类控件放在Pivot中。例如,尝试将 Map 控件放入 Pivot 中。

我建议您将 WebBrowserPivot 中取出,并将其放在单独的页面中。

This is correct behavior.

WebBrowser does that to enable Horizontal scrolling for web pages.

That is why it is not advisable to put such controls in a Pivot. For example, try putting a Map control inside a Pivot.

I recommend you take your WebBrowser out of Pivot and put it in a separate page.

魂牵梦绕锁你心扉 2024-10-26 16:04:45

不建议在 PivotPanorama< 中包含本身接受输入手势的控件(例如 MapWebBrowser 控件) /code> 正是因为这个原因。但是,有一篇关于 防止枢轴或全景控件滚动 这应该会给您一个解决方案。

It's not suggested to include controls that take input gestures themselves (such as the Map or WebBrowser controls) inside a Pivot or Panorama for this very reason. However, there is a post about Preventing the Pivot or Panorama controls from scrolling that should give you a solution.

清风挽心 2024-10-26 16:04:45

我怀疑这是正确的行为,因为它严重影响了这两个控件的可用性。 WebBrowser 这样做的事实是无关紧要的,因为网页可以通过标签禁用水平滚动,并强制渲染器重新排列文档,使其始终适合屏幕。在这种情况下,WebBrowser 完全没有理由消耗 Pivot 所需的水平滑动。

几个月前我已经在一个应用程序中解决了类似的问题,并且使用 Pivot - 这是可以规避的。我在这里写过: Windows Phone 7 WebBrowser控制吞噬操纵事件? 在那篇文章中还有另一个链接到另一个我的。抱歉,它有点分散,我没有时间把它放在一个地方。

如果我没记错的话,基本技巧是在 WebBrowser 上使用 GestureListener,监听轻弹并相应地强制 Pivot.SelectedIndex++/-- 。它将允许轻拂和移动,但不会提供拖动页面然后捕捉到下一个/上一个页面的旋转动画。对于这个动画,需要另一个技巧,IIRC,我的其他帖子就是关于这个的,

请注意:GestureListener,而不是操作事件!这些被 WebBrowser 消灭(API 7.0、7.1、7.5rc)(在 7.1+ 中 - 由内部 PanZoomContainer,在 7.0 中 - 它们只是被 TileHost 静音)! GestureListener 监听“其他来源”的事件并看到所有内容,即使 mani 事件已死。在 7.1+ 上,也可以侵入 WebBrowser 并劫持使用 mani-events,但它更难(我认为这也在我的另一篇文章中)

I doubt that this is a correct behaviour, because it severes the usability of those two controls. The fact that WebBrowser does that is irrelevant, because the web page CAN DISABLE horizontal scroling via tags, and force the renderer to reflow the document so it always fits the screen. In that case, the WebBrowser has completely no reason to consume the horiz-swipes that the Pivot needs.

I have already solved similar issue few months ago in one app, and with Pivot - it is circumventable. I've written on that here: Windows Phone 7 WebBrowser control swallows manipulation events? and also in that post is another link to another mine.. sorry, it's split up a bit, I didn't have time to put it in one place.

If I recall properly, the basic trick was to use GestureListener over the WebBrowser, listen to flicks and force Pivot.SelectedIndex++/-- accordingly. It will allow to flick&move, but will NOT provide the Pivot-y animation of dragging a page and then snapping to the next/prev page. For this animation, another trick is needed and IIRC that mine other post is about that

Please note: The GestureListener, not the manipulation events!!! those are extinguished (API 7.0, 7.1, 7.5rc) by the WebBrowser (in 7.1+ - by the internal PanZoomContainer, in 7.0 - they were simply silenced by TileHost)! GestureListener listens "on some other source" of events and sees everything even if mani-events are dead. On 7.1+ it is possible to hack into the WebBrowser and hijack use mani-events, too, but its harder (it also is in the other post of mine, I think)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文