A Frame is created like any other controls:
<Frame x:Name="contentRoot"
Navigated="OnNavigated"
Navigating="OnNavigating" />
The navigated/navigating events can then be intercepted to cancel the navigation or show/hide the back button.
private void OnNavigating(object sender, NavigatingCancelEventArgs e)
{
if(contentRoot.SourcePageType == e.SourcePageType && m_currentPageParameter == e.Parameter)
{
// we are navigating again to the current page, we cancel the navigation
e.Cancel = true;
}
}
private void OnNavigated(object sender, NavigationEventArgs e)
{
// user has navigated to a newest page, we check if we can go back and show the back button if needed.
// we can also alter the backstack navigation history if needed
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = (contentRoot.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed);
}