加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-phone-8 – Windows Phone 8 Web浏览器控件

发布时间:2020-12-14 02:50:10 所属栏目:Windows 来源:网络整理
导读:我想在 windows phone 8 webbrowser控件中控制双击缩放,但我能够在webbrowser控件中捕获双击事件.我也无法使用元标记属性指定缩放,因为我一直在显示来自第三方的页面,我也无法编辑 HTML页面,任何人都面临这样的问题,这很明显我不能能够从这个恢复超过2天,没
我想在 windows phone 8 webbrowser控件中控制双击缩放,但我能够在webbrowser控件中捕获双击事件.我也无法使用元标记属性指定缩放,因为我一直在显示来自第三方的页面,我也无法编辑 HTML页面,任何人都面临这样的问题,这很明显我不能能够从这个恢复超过2天,没有解决方案,

任何帮助将非常感谢!

问候,
Mawy,

解决方法

嗨这是我的代码停止滚动,缩放和双击它在我的项目与 Windows Phone 8和Windows Phone 8.1(SilverLight)工作正常

#region stop zoom and scroll
    public bool ScrollDisabled { get; set; }
    private void WB_Loaded(object sender,RoutedEventArgs e)
    {
        var border = WB.Descendants<Border>().Last() as Border;
        ScrollDisabled = true;
        border.ManipulationDelta += Border_ManipulationDelta;
        border.ManipulationCompleted += Border_ManipulationCompleted;
        border.DoubleTap += border_DoubleTap;
        //Debug.WriteLine("Height " + border.Child);
        //ContentPresenter cp = border.Child as ContentPresenter;
        //Debug.WriteLine("ContentPresenter " + cp.Height);
        //cp.Height = 650;
        //Debug.WriteLine("ContentPresenter " + cp.Content);
        //Grid gd = cp.Content as Grid;
        //Debug.WriteLine("ContentPresenter " + gd.Children.First());
        //border.MaxHeight = 700;
    }

    void border_DoubleTap(object sender,System.Windows.Input.GestureEventArgs e)
    {
        // suppress double-tap zoom
        e.Handled = true;
    }

    private void Border_ManipulationCompleted(object sender,ManipulationCompletedEventArgs e)
    {

        if (e.FinalVelocities.ExpansionVelocity.X != 0.0 ||
            e.FinalVelocities.ExpansionVelocity.Y != 0.0 
            ||(ScrollDisabled && e.IsInertial))
        {
            e.Handled = true;
            Debug.WriteLine("Scroll ManipulationCompleted");
        }
    }

    private void Border_ManipulationDelta(object sender,ManipulationDeltaEventArgs e)
    {
        // suppress zoom
        if (e.DeltaManipulation.Scale.X != 0.0 ||
            e.DeltaManipulation.Scale.Y != 0.0)
            e.Handled = true;

        //optionally suppress scrolling
        if (ScrollDisabled)
        {
            if (e.DeltaManipulation.Translation.X != 0.0 ||
              e.DeltaManipulation.Translation.Y != 0.0)
                e.Handled = true;
        }
    }
    #endregion

对于这个代码,它需要一个c#类,我发布here

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读