WPF System.Windows.Controls.WebBrowser不呈现链接按钮 [英] WPF System.Windows.Controls.WebBrowser not rendering link buttons

查看:77
本文介绍了WPF System.Windows.Controls.WebBrowser不呈现链接按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,我在桌面应用程序中的WPF WebBrowser控件中显示。我刚刚更新网页使用样式按钮而不是默认的灰色按钮,从asp.net按钮类型更改为asp.net LinkBut​​ton并应用CSS样式:

I have a web page that I display in a WPF WebBrowser control within a desktop application. I just updated the webpage to use styled buttons instead of the default gray buttons by changing from an asp.net Button type to an asp.net LinkButton and applying a CSS style to it:

    a.btnSave
    {
        background: url(Resources/Images/btnSave.png) no-repeat 0 0;
        display:inline-block;
        width: 75px;
        height: 23px;
        text-indent: -9999px;
    }
    a.btnSave:hover {background-position: 0 -23px;}

    a.btnCancel
    {
        background: url(Resources/Images/btnCancel.png) no-repeat 0 0;
        display:inline-block;
        width: 75px;
        height: 23px;
        text-indent: -9999px;
    }
    a.btnCancel:hover {background-position: 0 -23px;}

    a.btnReset
    {
        background: url(Resources/Images/btnReset.png) no-repeat 0 0;
        display:inline-block;
        width: 75px;
        height: 23px;
        text-indent: -9999px;
    }
    a.btnReset:hover {background-position: 0 -23px;}

...

<asp:LinkButton ID="btnSave" runat="server" CssClass="btnSave" OnClick="btnSave_Click" OnClientClick="OnSubmit()" UseSubmitBehavior="False" Text=" " />
<asp:LinkButton ID="btnCancel" runat="server" CssClass="btnCancel" OnClick="btnCancel_Click" OnClientClick="OnSubmit()" CausesValidation="False" Text=" " />
<asp:LinkButton ID="btnReset" runat="server" CssClass="btnReset" OnClick="btnReset_Click" OnClientClick="OnSubmit()" CausesValidation="False" Text=" " />

当我在IE 8(或firefox)中查看页面时,按钮显示正确。但是当我在应用程序中的WebBrowser控件中加载页面时,缺少按钮。如果我将鼠标悬停在他们应该在哪里,我不会收到手形图标,所以不只是图像没有加载。当我查看源代码,锚标记在那里,如果我复制源并将其保存到HTML文件,并在浏览器窗口中打开它们,它们确实显示正确。在过去,我遇到了WebBrowser的麻烦,不会像浏览器一样显示浮动div,并且不得不切换到表布局。它不支持内联块显示类型还是什么?

When I view the page in IE 8 (or firefox), the buttons appear correctly. But when I load the page in the WebBrowser control within the app, the buttons are missing. If I hover over where they should be I do not receive the Hand icon so it's not just that the images are not being loaded. When I view the source, the anchor tags are there and if I copy the source and save it to an HTML file and open that in a browser window, they do appear correctly. In the past, I've had trouble with the WebBrowser not dispalying floating divs the same way a browser does and had to switch to a table layout. Does it not support the inline-block display type or something?

如果重要的话,这是为页面声明的doctype:

If it matters, this is the doctype declared for the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


推荐答案

默认情况下使用兼容模式,风格。将其更改为

It was using compatability mode by default which was not honoring the styles. Changing it to

<meta http-equiv="X-UA-Compatible" content="IE=9" />

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

修复了它。

这篇关于WPF System.Windows.Controls.WebBrowser不呈现链接按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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