第一次加载后,Xamarin Forms WebView将不会刷新/重新加载?

问题描述:

我对xamarin完全陌生。 我想在更改后在IOS上刷新Web视图。 (以下代码在IOS模拟器上工作,但不在真实设备上,将显示兑现版本 - 以下代码中的IP地址是本地Web服务器,如果我在安装后更改了网站中的任何内容,则不会反映更改) 。第一次加载后,Xamarin Forms WebView将不会刷新/重新加载?

请帮忙。我究竟做错了什么 ?

干杯

的.xaml - >

<!--<controls:HybridWebView x:Name="hybridWebView"> 
     </controls:HybridWebView>--> 
<WebView x:Name="webView" 
VerticalOptions="FillAndExpand" 
Source="http://192.168.1.130" /> 
<StackLayout Orientation="Horizontal" 
    BindingContext="{x:Reference webView}"> 

    <Button Text="&#x21D0;" 
    FontSize="Large" 
    HorizontalOptions="FillAndExpand" 
    Clicked="OnGoBackClicked" /> 

    <Button Text="&#x21D2;" 
    FontSize="Large" 
    HorizontalOptions="FillAndExpand" 
    Clicked="OnGoForwardClicked" /> 
</StackLayout> 

.xaml.cs - >

public WebPage() 
    { 
     InitializeComponent(); 

    } 
    void OnEntryCompleted(object sender, EventArgs args) 
    { 
     //hybridWebView.Source = ((Entry)sender).Text; 
    } 
    void OnGoBackClicked(object sender, EventArgs args) 
    { 
     webView.Source="http://192.168.1.130"; 
    } 
    void OnGoForwardClicked(object sender, EventArgs args) 
    { 
     webView.Source = "https://www.google.com"; 

    } 

之前设置的,你需要找到它的源头。只需在按钮上单击此按钮即可

var vewbView = this.FindByName<WebView>("yourView"); 
     vewbView.Source = 
      "http://*.com/questions/38538970/xamarin-forms-webview-wont-refresh-reload-after-first-load#new-answer";