views:

168

answers:

1

Hello.
I use WebBrowser Silverlight 4 control to load some page:

<WebBrowser Height="350" Name="webBrowser" Width="400" />
...
webBrowser.Navigate(new Uri("http://mail.live.com")); 

But page loads with horizontal and vertical scroll bars. So I'm trying to find some ways to get actual size of loaded page (then I can change Height/Width of control) OR change scale of loaded page (to fit it to the actual WebControl control). Is it possible to do with standard WebControl methods?

A: 

Got you. Usually you can do that using the ViewBox, but it doesn't work with Webbrowser unfortunately. I guess you will have to wait for the next version of Webbrowser :(

--Old answer below:

I'm not sure if i understood your problem correctly, do you want the webbrowser to fit its parent container?

Maybe using HorizontalContentAlignment and VerticalContentAlignment like this?

<ScrollViewer HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
     <WebBrowser Name="webBrowser" />
</ScrollViewer>

Could you explain better?

Cheers

andrecarlucci
Thanks for your answer. It's not exactly what I need. So, details. For example: I'm trying to open some web-page with WebBrowser control instance with Height="600" and Width="900". Page opens correctly. Then I decide to change size of WebBrowser control and set Height="300" and Width="600". Of course entire page can't displays inside WebBrowser and scrollbars appears. SO I'm seeking for a way to remove these scrollbars (and display entire page). Most preferable way - change scale of the web page inside WebBrowser control.
zenonych