locked
Handling the "Back" navigation helper in universal apps

    Question

  • I'm adding support for Windows Phone to a Windows Store app using a universal app. One of my pages is fairly simple and can be reused on phone and win8 so I want to put this page in the shared project. One thing that comes up as a problem is the back arrow in the top left. This is a fairly standard navigation item in store apps but not necessary on phone because of the hardware back key. If there a way to handle this gracefully in xaml in a shared project?
    Saturday, May 17, 2014 9:55 PM

Answers

  • This is where having separate Xaml for Phone and Windows Store is useful. You cannot conditionally compile the Xaml, so you need to either have separate versions or you'll need to make run-time changes. For example, you could bind the visibility of the component to a property which is trust on phone and false on Windows Store.
    • Marked as answer by RWSoftware Sunday, May 18, 2014 7:16 AM
    Saturday, May 17, 2014 10:24 PM
    Owner

All replies

  • This is where having separate Xaml for Phone and Windows Store is useful. You cannot conditionally compile the Xaml, so you need to either have separate versions or you'll need to make run-time changes. For example, you could bind the visibility of the component to a property which is trust on phone and false on Windows Store.
    • Marked as answer by RWSoftware Sunday, May 18, 2014 7:16 AM
    Saturday, May 17, 2014 10:24 PM
    Owner
  • I was afraid you would say that. Was hoping there would be a better solution as the entire page is compatible but for the navigation cues. Would be a shame to have to copy and paste a layout for the sake of one button. I'll see if there is something I can drop into a view model
    Saturday, May 17, 2014 10:30 PM
  • Depending on how you have things laid out you may be able to use different styles set up in non-shared app resources. The phone style can hide it.
    Sunday, May 18, 2014 11:58 AM
    Owner