4

I've been tinkering with Xamarin forms and I have run into a bit of a road block. I have an app whose rootPage is a TabbedPage. I programmatically add three child Contentpages to this page. All this works fine. However, these pages open up other pages which may or may not open other pages etc.

I have tried to use ContentPage for the child pages and pass the rootpage Navigation property into them and use that to call Navigation.PushAsync I have also tried to make the pages navigation pages and then call Navigation.PushAsync on their own property: this throws some unhandled exception

Can anyone please help!

Obi
  • 3,091
  • 4
  • 34
  • 56

1 Answers1

5

The root of each tab in your TabbedPage should be a single NavigationPage, which wraps a ContentPage. From that ContentPage you navigate to other pages by using the Navigation property of the page.

Jason
  • 86,222
  • 15
  • 131
  • 146
  • Hi @Jason, so to make sure I understand you right, each child page should be a NavigationPage with a ContentPage inside it. From the ContentPage I could then navigate to other pages using the navigation property of the parent NavigationPage....right? – Obi Nov 27 '14 at 16:50
  • Correct. Do not try to add multiple Navigation pages to single "stack", or try to pass the Navigation property explicitly - Forms will take care of this for you if you do it correctly. – Jason Nov 27 '14 at 16:56
  • I was still getting the error so I decided to post some sample code here and in a most curious twist of events, while cleaning up the code so it would be fitting for the whole world to see, I tried to run it to get a screenshot of the error message and behold IT WORKED!! So thanks for your advice @Jason, this did it for me – Obi Nov 27 '14 at 18:34