Universal Apps – Navigation

Unlike the navigation on Windows Phone 7, the navigation is a bit more complex in a Universal App, but luckily, Microsoft has provided some helpers. To add the helpers, you need to create the page with a Basic rather than a Blank page. You will be told that you are missing components and do you want to add them. Accept and the navigation components will be added. One key point that MVP Andy Wigley mentioned in an MVA course on Building Apps for Windows Phone 8.1 JumpStart is that the Blank default MainPage is created with a Blank page rather than a Blank Page. So you need to delete the MainPage and create a new one from a Basic page.

For some reason, I used cut & paste to merge a WP7 project into a UA project and somehow lost the name of the page (It should be pageRoot). Trying to work out what went wrong was not easy. For the most part, the process seemed easy. Create a skeleton app with the name you want, delete MainPage and replace with a new one based on Basic page and cut and paste the code. Ignore the declaration section of the old cold and just copy over the content of the Grid.

The NavigationService.Navigate are replaced with Frame.Navigate(typeof(NextPage));

Most of the code in the cs files are placed in classes using the same name in the Project.Shared folder. So there should be a MainPage.xaml.cs in that folder when you are done. The code in the xaml files will be in the Windows and duplicated in the Phone folders. This is where most of the differences of the Windows and Phone versions of the app will appear.

Andy Wigley’s JumpStart course on MVA is a good start.

Next time languages.

Enjoy.

John Marshall… Visio MVP       Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993