WPF WebBrowser控件 - 位置:滚动时固定元素跳(Windows 8中) [英] WPF WebBrowser Control - position:fixed Element jumps while scrolling (Windows 8)

查看:488
本文介绍了WPF WebBrowser控件 - 位置:滚动时固定元素跳(Windows 8中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用WPF WebBrowser控件来显示嵌入页面。在Windows 8中,我们观察到用CSS定位元素的一个奇怪的跳跃行为:滚动时固定的。

在同一页工作正常IE10在Windows 8(也FF,铬),并在Windows 7中的WPF WebBrowser控件。

有没有人见过这种行为,并知道了跳跃运动修复?

是否有可能在.NET 4.5版在测试机上使用(表面与Win 8)相比,.NET版本4开发计算机上的问题?

开发环境:


  • Windows 7中

  • 微软的Visual Studio 2010版本10.0.30319.1 RTMRel

  • Microsoft .NET Framework版本4

测试环境:


  • 表面

  • Windows 8的

  • Microsoft .NET框架4.5版

客户端XAML:

 <窗​​口x:类=EmbeddedBrowserTest.MainWindow
        的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
        的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
        标题=主窗口HEIGHT =350WIDTH =525>
    <网格和GT;
        < web浏览器的Horizo​​ntalAlignment =拉伸NAME =web浏览器VerticalAlignment =拉伸Grid.Row =1/>
    < /网格和GT;
< /窗GT;

演示页HTML:

 <!DOCTYPE HTML>
< HTML和GT;< HEAD>
    < META HTTP-EQUIV =X-UA-Compatible的内容=IE = 9/>
    <标题>最小的位置固定例如< /标题>
    <风格>
        身体 {
            保证金:0像素
        }
        .header {
            高度:60像素;
            宽度:960像素;
            背景色:#CCCCCC;
            顶:0像素;
            左:0像素;
            位置:固定;
            的z-index:10;
        }
        。内容{
            填充顶:60像素;
            高度:420px;
            宽度:960像素;
            背景色:浅钢;
        }
    < /风格>
< /头><身体GT;
    < D​​IV CLASS =头>
        头
    < / DIV>
    < D​​IV CLASS =内容>
        内容< BR> 1< BR> 2'; BR> 3'; BR> 4℃; BR> 5℃BR> 6≤BR> 7< BR>
    < / DIV>
< /身体GT;< / HTML>


解决方案

我们在新机同时运行Windows 8的检查了一遍,错误不见了,一些检查后,我们确定了新的机器有一些新的更新为Windows 8安装。我们去检查的表面更新和应用所有更新的错误之后似乎消失了。

只是没有采用最新的运8的更新错误是固定的任何重新编译或进一步的设置。

滚动现在是平滑的。同一个可执行文件没有改变,所以我想这是在运行时库的一些bug毕竟。

We use the WPF WebBrowser control to display an embedded page. On Windows 8 we observe a strange jumping behavior of elements with css position:fixed while scrolling.

The same page works fine in IE10 on Windows 8 (also FF, Chrome) and in the WPF WebBrowser control on Windows 7.

Has anyone seen this behavior before and knows a fix for the jumping motion?

Is it possible the .NET Version 4.5 used on the test machine (Surface with Win 8) be the Problem as compared to the .Net Version 4 on the dev machine?

The Development Environment:

  • Windows 7
  • Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
  • Microsoft .NET Framework Version 4

The Test Environment:

  • Surface
  • Windows 8
  • Microsoft .NET Framework Version 4.5

Client XAML:

<Window x:Class="EmbeddedBrowserTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WebBrowser HorizontalAlignment="Stretch" Name="webBrowser" VerticalAlignment="Stretch" Grid.Row="1" />
    </Grid>
</Window>

Demo Page HTML:

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <title>minimal position fixed example</title>
    <style>
        body {
            margin: 0px
        }           
        .header{
            height: 60px;
            width: 960px;
            background-color: #cccccc;
            top: 0px;
            left: 0px;
            position: fixed;
            z-index: 10;
        }    
        .content{
            padding-top: 60px;
            height: 420px;
            width: 960px;
            background-color: lightsteelblue;
        }    
    </style>
</head>

<body>
    <div class="header">
        header
    </div>    
    <div class="content">
        content <br> 1 <br> 2 <br> 3 <br> 4 <br> 5 <br> 6 <br> 7 <br>
    </div>                
</body>

</html>

解决方案

We checked again on a new Machine also running Windows 8 and the error was gone, after some checks we determined that the new Machine had some new Updates for Windows 8 installed. We went to check for Updates on the Surface and after applying all Updates the Error seems to be gone.

Without any recompilation or further settings just by applying the latest Win 8 Updates the error is fixed.

Scrolling is smooth now. Same executable no changes, so i guess it was some bug in the runtime libs after all.

这篇关于WPF WebBrowser控件 - 位置:滚动时固定元素跳(Windows 8中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆