Embed WebPage using Frame

ray6402
Posts: 5
Joined: Fri Aug 18, 2017 5:25 am

Embed WebPage using Frame

Postby ray6402 » Fri Apr 20, 2018 3:44 am

Hi

How do I embed a webpage in XAML using <Frame>?

I currently have:

Code: Select all

<StackPanel Margin="10">
        <Frame Source="https://www.google.co.za"/>
</Stackpanel>


In the XAML Designer I can see it loading the webpage, however in the Simulator I only get a blank screen.

Drilling down into the Visual Tree, I see that the Frame <Source> is "null"
Visual Tree.png
Visual Tree.png (5.26 KiB) Viewed 9152 times

Then when I run it in the Chrome browser, I get the same as the simulator.

Drilling down into the html code, I see that the Frame does not have a <Source> property.
HTML.PNG
HTML.PNG (17.34 KiB) Viewed 9152 times

Am I doing something wrong?

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Embed WebPage using Frame

Postby JS-Support @Userware » Sun Apr 22, 2018 11:55 pm

Hi,

Please use the <WebView> control for that. (Note: in SL Migration projects, it's called "<WebControl>".

Regards,
JS-Support

ray6402
Posts: 5
Joined: Fri Aug 18, 2017 5:25 am

Re: Embed WebPage using Frame

Postby ray6402 » Wed Apr 25, 2018 4:53 am

Hi,

I tried using the <WebView> control as follows:

Code: Select all

    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button Grid.Row="0"
                Content="webview nav"
                Click="Button_Click"/>
        <WebView Grid.Row="2"
                 x:Name="TestWeb"/>
    </Grid>


By clicking on the button, you should show the Google homepage in the remaining area.

Code: Select all

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TestWeb.Navigate(new Uri("https://www.google.co.za"));
        }


In the designer, it shows:
Designer.PNG
Designer.PNG (1.04 KiB) Viewed 9122 times


When I run the code, nothing happens on button click.
I tried using TestWeb.NavigateToString() as an alternative and that only shows a the URI string instead of the actual webpage.

Can you provide me with an example of how the <WebView> Control should be used instead?


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 35 guests

 

 

cron