Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Problem with Navigation

$
0
0

Hi,
I have a problem with the Navigation system in my app.

In my App.cs i have this code:

public static Page GetMainPage()
{
      return new NavigationPage(new DashboardView());
}

The dashboard is created, it gets drawn and everythings ok.
Then the user can navigate to another ContentPage called 'Contacts' with a list of his contacts.

private async void ContactButton_Clicked(object sender, EventArgs e)
{
      try
      {
           await Navigation.PushAsync(contactView);
      }
      catch (Exception ex)
      {
           errorLabel.Text = ex.Message + ": " + ex.StackTrace;
      }
  }

If he clicks on one he gets navigated to an TableView where I present the contact data.

if (item.Equals(e.Item))
{
          await Navigation.PushAsync(new ContactDetailView(item));
}

So now my problem starts. When I go back to my dashboard with the back button that is shown in the toolbar I can't open the 'Contacts' page again.
If I just go in the 'Contacts' page and navigate back to the dashboard it works. But as soon as I go into a detail view its over.
Under android it works perferctly but in iOS i get this error presented:

Page must not already have a parent at Xamarin.Forms.NavigationProxy.PushAsync...

Why do I get this error? Is there something wrong with the Navigation Stack on iOS?
Does someone facing this problem, too?

I hope someone can help me on that.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>