Webview 在xamarin表单中显示html格式的数据

Webview 在xamarin表单中显示html格式的数据,webview,xamarin.forms,Webview,Xamarin.forms,我使用webview显示来自数据库的html格式的数据。我已经尝试实现HtmlWebViewSource来显示数据,但它没有显示。以下是我已经实现的 <WebView VerticalOptions="Fill" BackgroundColor="Red"> <WebView.Source> <HtmlWebViewSource x:Name="surveyInstruction

我使用webview显示来自数据库的html格式的数据。我已经尝试实现HtmlWebViewSource来显示数据,但它没有显示。以下是我已经实现的

<WebView VerticalOptions="Fill" BackgroundColor="Red">
                    <WebView.Source>
                        <HtmlWebViewSource x:Name="surveyInstruction"/>
                    </WebView.Source>
                </WebView>
这是我从数据库中得到的

Question<font size="4"><b> Instruction</b></font>
我也参考了这篇文章

将垂直选项从“填充”更改为“填充”和“展开”,您应该能够查看网络视图或根据要求设置网络视图的高度。

您使用的是什么版本的Xamarin.Forms?我记得有一些类似的问题

我将WebView与绑定一起使用,这对我来说很好

    <WebView
        HorizontalOptions="FillAndExpand"
        VerticalOptions="FillAndExpand">
        <WebView.Source>
            <HtmlWebViewSource Html="{Binding PrivacyPolicyAsHtml}" />
        </WebView.Source>
    </WebView>
PrivacyPolicyAsHtml属性存在于视图模型中,并在其中分配

    <WebView
        HorizontalOptions="FillAndExpand"
        VerticalOptions="FillAndExpand">
        <WebView.Source>
            <HtmlWebViewSource Html="{Binding PrivacyPolicyAsHtml}" />
        </WebView.Source>
    </WebView>