WPF WebBrowser Control - position:fixed 元素在滚动时跳转(Windows 8) [英] WPF WebBrowser Control - position:fixed Element jumps while scrolling (Windows 8)

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

问题描述

我们使用 WPF WebBrowser 控件来显示嵌入的页面.在 Windows 8 上,我们观察到带有 css position:fixed 的元素在滚动时出现奇怪的跳跃行为.

相同的页面在 Windows 8 上的 IE10(以及 FF、Chrome)和 Windows 7 上的 WPF WebBrowser 控件中都可以正常工作.

有没有人以前见过这种行为并且知道如何解决跳跃动作?

与开发机器上的 .Net 版本 4 相比,测试机器上使用的 .NET 版本 4.5(Win 8 的 Surface)是否可能是问题?

开发环境:

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

测试环境:

  • 表面
  • Windows 8
  • Microsoft .NET Framework 4.5 版

客户端 XAML:

<网格><WebBrowser Horizo​​ntalAlignment="Stretch" Name="webBrowser" VerticalAlignment="Stretch" Grid.Row="1"/></网格></窗口>

演示页面 HTML:

<头><meta http-equiv="X-UA-Compatible" content="IE=9"/><title>最小位置固定示例</title><风格>身体 {边距:0px}.header{高度:60px;宽度:960px;背景颜色:#cccccc;顶部:0px;左:0px;位置:固定;z-索引:10;}.内容{填充顶部:60px;高度:420px;宽度:960px;背景颜色:lightsteelblue;}</风格><身体><div class="header">标题

<div class="内容">内容 <br>1 <br>2 <br>3 <br>4 <br>5 <br>6 <br>7 <br>

解决方案

我们再次检查了一台同样运行 Windows 8 的新机器,错误消失了,经过一些检查,我们确定新机器有一些适用于 Windows 8 的新更新安装.我们去检查 Surface 上的更新,在应用所有更新后,错误似乎消失了.

无需任何重新编译或进一步设置,只需应用最新的 Win 8 更新即可修复错误.

滚动现在很流畅.相同的可执行文件没有更改,所以我想这毕竟是运行时库中的一些错误.

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 Control - position:fixed 元素在滚动时跳转(Windows 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
C#/.NET最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆