Xaml Xamarin HtmlWebViewSource未绑定
此绑定确实显示了我的html:Xaml Xamarin HtmlWebViewSource未绑定,xaml,xamarin,binding,Xaml,Xamarin,Binding,此绑定确实显示了我的html: <Label Grid.Row="1" Text="{Binding theInstructions}" /> 所以我想我有约束力 这个网络视图确实显示了谷歌: <WebView Grid.Row="1" Source="http://www.google.com" /> 所以WebView本身在我的ContentPage中工作 但是,无论我如何简化
<Label Grid.Row="1" Text="{Binding theInstructions}" />
所以我想我有约束力
这个网络视图确实显示了谷歌:
<WebView Grid.Row="1" Source="http://www.google.com" />
所以WebView本身在我的ContentPage中工作
但是,无论我如何简化html,这个带有绑定的WebView都不会显示任何内容:
<WebView
Grid.Row="1" HorizontalOptions="Fill" VerticalOptions="EndAndExpand">
<WebView.Source>
<HtmlWebViewSource Html="{Binding theInstructions}" />
</WebView.Source>
</WebView>
我错过了什么
编辑编辑编辑
狮子座基本上就在这里,所以很受欢迎。这不是绑定问题,而是布局问题
以下代码不显示HTML:
<WebView Grid.Row="1">
<WebView.Source>
<HtmlWebViewSource Html="{Binding theInstructions}" />
</WebView.Source>
</WebView>
但前提是HTML足够短。再长一行,它就会消失
我尝试了几十种StackLayouts、ScrollView、HeightRequests、MinHeightRequests等组合。我所做的任何其他事情都会让HTML消失——即使是短的东西,更不用说长的东西了
我很震惊Xamarin在这么长时间后仍然这么糟糕
所以。。。这仍然是一个悬而未决的问题。显然绑定的web视图存在问题???可能需要设置WebView的
WidthRequest
和HeightRequest
属性才能查看HTML内容,具体取决于WebView的子布局。例如,这在堆栈布局中是必需的
所以,试着像这样改变:
<StackLayout>
<WebView WidthRequest="1000" HeightRequest="1000">
<WebView.Source>
<HtmlWebViewSource Html="{Binding theInstructions}" />
</WebView.Source>
</WebView>
</StackLayout>
可能需要设置网络视图的
宽度请求
和高度请求
属性,以查看HTML内容,具体取决于网络视图所属的布局。例如,这在堆栈布局中是必需的
所以,试着像这样改变:
<StackLayout>
<WebView WidthRequest="1000" HeightRequest="1000">
<WebView.Source>
<HtmlWebViewSource Html="{Binding theInstructions}" />
</WebView.Source>
</WebView>
</StackLayout>
能用吗?能用吗?