Hello,
If you want to change the url when click the button at the runtime.
- Firstly, please use WebView directly, no need to new webview.
- Second, No need to reload webview, just set the url directly.
You can refer to the following code.
void OnReloadWebView(object sender, EventArgs e)
{
try
{
WebView.Source = new UrlWebViewSource
{
Url "https://blog.xamarin.com/"
};
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.