views:

203

answers:

2

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?

+2  A: 

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.

Justin Ethier
Perfect! It even explains in the MSDN link the reason why in IE7 and 8 this toolbar does not appear. Thank you very much, enjoy your bounty :)
hmemcpy
You're welcome, glad to help!
Justin Ethier
A: 

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;
}
Dommer