I have my own stack/navigation model, but I would like to have the standard Back button appear beside the header of my page.
What code do I need to make it appear?
The examples just do something like this:
void Header_Click(object sender, RoutedEventArgs e)
{
// Determine what group the Button instance represents
var group = (sender as FrameworkElement).DataContext;
// Navigate to the appropriate destination page, configuring the new page
// by passing required information as a navigation parameter
this.Frame.Navigate(typeof(GroupDetailPage),
((SampleDataGroup)group).UniqueId);
}
and it automatically shows up.
I’ve looked through various msdn pages but they mostly talk about the design pattern.
Thanks
In the Visual Studio project templates (aside from Blank App), you’ll see the following XAML in the page
so the visibility of the button is driven by whether or not there’s a backstack for the application, and
pageRoothere is thex:Nameassociated with the given Page.Note, that the GoBack method is part of the LayoutAwarePage that you get for all of the templates other than the blank one. It sounds like you have your own version of “LayoutAwarePage” in which case you’ll have to wire up whatever code makes sense to execute on a back button for your navigation model.
Keep in mind that LayoutAwarePage will the basis for a LOT of Windows Store applications, so if you deviate too much from that de facto default navigation scheme, you might confuse your users that are used to behavior in other applications. Would it make sense to extend from LayoutAwarePage perhaps, in which case you’ll get the default behavior (including the Back button) and then you can add your own special sauce on top?