King Chan
King Chan

Reputation: 4302

How can I put WebBrowser display behind my control?

I am trying to make a menu on top of WebBrowser control, so when user select it, it will tell the WebBrowser to go centain page.

So I did something like:

<Grid x:Name="Root">
    <WebBrowser Name="_WebBrowser" Source="http://google.ca" Grid.Column="0" Grid.Row="0"></WebBrowser>    
    <Expander Name="expander1" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="250" ExpandDirection="Right" IsExpanded="True" Grid.Column="0" Grid.Row="0">

Far as I know, the last define control should be on top...

But strange, the WebBrowser will always display on top....and it covers my Expander (menu). I tried to put WebBrowser inside a Carvas or even Button lol But the WebBrowser it is still display on the top....

I hope this is not a bug in .NET 3.5.....

Upvotes: 3

Views: 4267

Answers (1)

Mike Christensen
Mike Christensen

Reputation: 91608

The short answer is this is a limitation of WPF.

The WebBrowser control is simply a managed wrapper around the Windows COM component, which has its own window handle. For this reason, you're not able to draw over it.

More details: WPF 3.5 WebBrowser control and ZIndex

Upvotes: 4

Related Questions