【发布时间】:2021-07-22 07:38:12
【问题描述】:
我有一个在 XAML 中完全定义的 WebView。它显示来自本地文件的“帮助文件”。它适用于带有Source="file:///android_asset/Getting Started Text.html" 的Android。我现在正试图让它在 UWP 上工作,所以我添加了OnPlatform,如下所示。我得到:
XFC0009 找不到“源”的属性、BindableProperty 或事件,或者值和属性之间的类型不匹配。在
上。
我也试过x:TypeArguments="x:String" 并得到同样的错误。 x:TypeArguments 应该是什么Webview.Source?
<WebView WidthRequest="1000" HeightRequest="1000">
<WebView.Source>
<OnPlatform x:TypeArguments="x:Uri">
<OnPlatform.Platforms>
<On Platform="Android" Value="file:///android_asset/Getting Started Text.html" />
<On Platform="UWP" Value="ms-appx-web:///Getting Started Text.html" />
</OnPlatform.Platforms>
</OnPlatform>
</WebView.Source>
</WebView>
Windows 10 Pro 64 上的 VS 2019 16.9.4 社区。Xamarin 16.9
【问题讨论】:
标签: xaml xamarin.forms webview