0

I am trying to display a browser in a ViewBox element on a Windows Phone 8 Nokia Lumia.

The WebBrowser is displaying when it is alone, but when I put it in a ViewBox element, it does not show.

Here is my sample code:

<phone:PhoneApplicationPage
    x:Class="PhoneApp2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->

    <Viewbox Stretch="Fill" >

        <phone:WebBrowser Source="http://google.com" />
    </Viewbox>

</phone:PhoneApplicationPage>
myexec
  • 470
  • 1
  • 4
  • 13

1 Answers1

0

hey the problem is the default height and width of viewbox control..just set the height and width of your view box control ..like this it will work..

<Viewbox Grid.Row="0"  VerticalAlignment="Top" HorizontalAlignment="Left">
        <phone:WebBrowser Grid.Row="0" Height="800" Source="http://www.google.com" Width="500" />
    </Viewbox>

any query..comment below..

loop
  • 9,002
  • 10
  • 40
  • 76
  • OK this worked. I needed to set the width and height only of the WebBrowser, but shouldn't it work if they are set to "auto" ? – myexec Jul 18 '13 at 09:52
  • i have tried all combination but in each case some how we are setting the height and width of the browser..main cause i really don't know – loop Jul 18 '13 at 10:10