简体   繁体   中英

Navigating from Webview to an app page in xamarin forms

I'm having my website cloned into an application completely. However for maps purposes, im trying to navigate to my application page which is not a webview. can someone please guide me through this? Below is my code.

    private void WebView_Navigated(object sender, WebNavigatedEventArgs e)
    {
        WebView view = new WebView();
        view.Reload();
        if (e.Url.Contains("thank-you-woo"))
        {
        System.Threading.Thread.Sleep(1000);

            DisplayAlert("Track", "Tracking Started", "Close this alert");
           NavigationPage page = new NavigationPage(new MainPage());
        }

    }

Please note, pushasync or navigation page, both of the are not taking me to the desired page.

Set the NavigationPage in App.xaml.cs and then use the Navigation.PushAsync works for me.

App.xaml.cs:

 public App()
    {
        InitializeComponent();

        MainPage = new NavigationPage(new Page29());
    }

Page29.xaml.cs:

  async void WebView_Navigated(object sender, WebNavigatedEventArgs e)
    {
        await Navigation.PushAsync(new Page30());
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM