How to set a page on a Silverlight WebBrowser control?

I am using a Silverlight 4 WebBrowser control to load some page:

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

But pages with horizontal and vertical scrollbars are loading. So I’m trying to find some ways to get the actual size of the loaded page (then I can change the height / width of the control) OR change the scale of the loaded page (so that it matches the actual WebControl control), Can I use standard WebControl methods?

+5
source share
3 answers

- Silverlight COM-, Silverlight.

. 1) - , .

2) , "" -, Zoom. , , , .

http://forums.silverlight.net/forums/p/200177/466986.aspx

+5

. ViewBox, , , Webbrowser. , Webbrowser: (

- :

, , , webbrowser ?

, HorizontalContentAlignment VerticalContentAlignment, ?

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

?

0

You can compress the WebBrowser control by wrapping it in a ViewBox control, and then set the width and height in the ViewBox instead of the web browser. You also need to set the Stretch property in the viewport to Uniform.

<ViewBox x:Name="MyViewBox" Width="350" Height="350" Stretch="Uniform">
    <WebBrowser x:Name="MyWebBrowser" Source="...." />
</ViewBox>

NTN.

If this helps, mark as an answer. Thank,

0
source

All Articles