Page 1 of 1

Embed WebPage using Frame

Posted: Fri Apr 20, 2018 3:44 am
by ray6402

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

I currently have:

Code: Select all

<StackPanel Margin="10">
        <Frame Source=""/>

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 2856 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 (17.34 KiB) Viewed 2856 times

Am I doing something wrong?

Re: Embed WebPage using Frame

Posted: Sun Apr 22, 2018 11:55 pm
by JS-Support @Userware

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


Re: Embed WebPage using Frame

Posted: Wed Apr 25, 2018 4:53 am
by ray6402

I tried using the <WebView> control as follows:

Code: Select all

    <Grid Margin="10">
            <RowDefinition Height="auto"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="*"/>
        <Button Grid.Row="0"
                Content="webview nav"
        <WebView Grid.Row="2"

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(""));

In the designer, it shows:
Designer.PNG (1.04 KiB) Viewed 2826 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?