Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

What is the best way to render a WebView with Source as HtmlWebviewSource Html =

$
0
0

I am currently working on an app feature where I need to show text in HTML format from server side coming via REST APIs.

The size of the text/html content varies per row and I trying to show the data in a scroll view containing multiple WebViews inside a big stack layout

My single row component looks like this,

<ContentView x:Name="RowComponent">

    <Grid>

        <Grid.RowDefinitions>

                    <RowDefinition Height="Auto" />

                    <RowDefinition Height="Auto" />

                    <RowDefinition Height="*" />

        </Grid.RowDefinitions>

        <Label Grid.Row=0/>

        <Label Grid.Row=1/>

        <WebView Grid.Row=2>

            <WebView.Source>

                <HtmlWebViewSource Html="{Binding FormattedMessage}" />

            </WebView.Source>

        </WebView>

    </Grid>

<ContentView>

And also the rows are repeated inside a content page like the following,

<ContentPage>

    <ScrollView>

        <StackLayout>

            <StackLayout>

                <StackLayout />

                <StackLayout>

                    <!-- Inside this there are multiple rows of the above component '**RowComponent**' -->

                </StackLayout>

            </StackLayout>

            <StackLayout/>

        </StackLayout>

    </ScrollView>

</ContentPage>

According to the Xamarin Forms documentation about WebView: "Grid without WidthRequest & HeightRequest. Grid is one of the few layouts that does not require specifying requested heights and widths." (Xamarin.Forms WebView Layout)

However, the WebView is not even showing up or showing any content. How can I fix this?

Thank you in advance.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>