Firefox 托管的 xbap 应用程序中的奇怪工具栏

发布于 2024-08-18 07:43:25 字数 245 浏览 4 评论 0原文

我有一个 xbap 应用程序,它基本上是托管在 WPF 控件中的 Windows 窗体。当我用 Firefox 运行它时,我得到了工具栏,但我似乎无法删除它。如果我直接执行 xbap,此工具栏不会在 IE 中出现,但如果我将 xbap 嵌入 iframe 中,它就会出现。

alt text

有什么想法如何删除它吗?

I have an xbap application which is basically a Windows Form hosted in a WPF control. When I run it with Firefox, I get toolbar, which I can't seem to remove. This toolbar does not appear with IE if I execute the xbap directly, but it does appear if I embed the xbap within an iframe.

alt text

Any ideas how to remove this?

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

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

发布评论

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

评论(2

云之铃。 2024-08-25 07:43:25

使用 Page.ShowsNavigationUI 属性将其隐藏。从 MSDN 文档,您可以在 XAML 中执行此操作:

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="HomePage"
    ShowsNavigationUI="False"
>


...


</Page>

或在代码中执行此操作:

using System;
using System.Windows;
using System.Windows.Controls;

namespace CSharp
{
    public partial class HomePage : Page
    {
        public HomePage()
        {
            InitializeComponent();

            // Hide host's navigation UI
            this.ShowsNavigationUI = false;
        }
    }
}

此外,在 WPF 集成允许本机浏览器导航 UI 控制 XBAP 应用程序的浏览器中,工具栏不会出现:

由于 WPF 没有与 Microsoft Internet Explorer 6 的导航 UI 集成,因此它提供了自己的导航 UI,可以通过设置 ShowsNavigationUI 显示或隐藏该导航 UI。 WPF 确实与 Windows Internet Explorer 7 导航 UI 集成,因此在 Windows Internet Explorer 7 中的页面上设置 ShowsNavigationUI 无效。

Use the Page.ShowsNavigationUI property to hide it. From the MSDN Documentation, you may do this in XAML:

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="HomePage"
    ShowsNavigationUI="False"
>


...


</Page>

, or in code:

using System;
using System.Windows;
using System.Windows.Controls;

namespace CSharp
{
    public partial class HomePage : Page
    {
        public HomePage()
        {
            InitializeComponent();

            // Hide host's navigation UI
            this.ShowsNavigationUI = false;
        }
    }
}

Also, the toolbar does not appear in browsers where WPF integration allows the native browser navigation UI to control the XBAP application:

Because WPF does not integrate with the navigation UI for Microsoft Internet Explorer 6, it provides its own navigation UI, which can be shown or hidden by setting ShowsNavigationUI. WPF does integrate with the Windows Internet Explorer 7 navigation UI, so setting ShowsNavigationUI on pages in Windows Internet Explorer 7 has no effect.

伊面 2024-08-25 07:43:25

我给+1 贾斯汀一个很好的答案。

只是补充一下,如果您处理的不是页面而是 ascx,您可以这样做......

public Whatever()
{
    this.Navigated += new NavigatedEventHandler(Whatever_Navigated);
}

private void Whatever_Navigated(object sender, NavigationEventArgs e)
{
    NavigationWindow ws = (e.Navigator as NavigationWindow);
    ws.ShowsNavigationUI = false;
}

I gave +1 for a great answer Justin.

Just to add, if you are not dealing with a page but rather an ascx, you can do this like so...

public Whatever()
{
    this.Navigated += new NavigatedEventHandler(Whatever_Navigated);
}

private void Whatever_Navigated(object sender, NavigationEventArgs e)
{
    NavigationWindow ws = (e.Navigator as NavigationWindow);
    ws.ShowsNavigationUI = false;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文