none
Windows Metro content frame navigation and back button visibility

    Question

  • I have a Win Metro app that is a XAML/MonoGame hybrid game written in C# with a XAML start page that contains a frame that gets loaded with menu buttons.

    After submitting this to the Win Metro store I get a test protocol back basically just containing a screen shot of the start screen of my app and saying "Feature not functional" with the two buttons of the start screen circled in red. There has never been a problem using those buttons on my setup (two different Win 8 Machines + simulator).

    Another strange thing is that the back button is visible, which should not be possible as I explicitly set IsEnabled of the back button to False if the frame is the start frame (originally I had the IsEnabled property binding set in XAML to CanGoBack of the content frame, but that did not work either).

    This is the code for setting the visibility of the back button when the user navigates:

        public MainPage()
        {
            this.InitializeComponent();
    
            contentFrame.Navigate(typeof(MainFrame));
    
            Window.Current.SizeChanged += VisualStateChanged;
            contentFrame.Navigated += contentFrame_Navigated;
        }
    
        void contentFrame_Navigated(object sender, NavigationEventArgs e)
        {
            ApplicationViewState visualState = ApplicationView.Value;
    
            VisualStateManager.GoToState((Control)e.Content, 
                   visualState.ToString(), false);
    
            if (e.Content is MainFrame)
                backButton.IsEnabled = false;
            else
                backButton.IsEnabled = contentFrame.CanGoBack;
        }
    
        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            contentFrame.GoBack();
        }
    
        internal void GoHome()
        {
            while( contentFrame.CanGoBack )
                contentFrame.GoBack();
        }

    GoHome() is called from the game page if a user opts to quit the game there (I don't get to see any back button in the start page from there either):

        private void QuitGame(IUICommand command)
        {
            App.ClearGame();
    
            Window.Current.Content = App.MainPage;
            Window.Current.Activate();
            App.MainPage.GoHome();
        }

    And here is the code for the buttons in the MainFrame:

        private void onePlayerButton_Click(object sender, RoutedEventArgs e)
        {
            this.Frame.Navigate(typeof(OnePlayerFrame));
        }
    
        private void twoPlayersButton_Click(object sender, RoutedEventArgs e)
        {
            this.Frame.Navigate(typeof(TwoPlayersFrame));
        }

    So my question is: can the visibility of the back button be handled differently on a Surface device compared to on a Desktop PC, or how can the tester otherwise get a screen shot where the back button is visible? And - do any of you have similar experiences when submitting apps to the Windows Metro store?

    I really wish Microsoft would give more detail in the test protocol, it would save time for everyone in the long run...


    Monday, December 31, 2012 10:03 AM

Answers

  • Thanks for your reply. I have gotten the app through certification now.

    I thought I'd follow up with what finally got the app working if others are facing similar problems.

    I made two changes before making the submit that got the app through certification: I changed the order of

     contentFrame.Navigated += contentFrame_Navigated;

    and

     contentFrame.Navigate(typeof(MainFrame));

    (so it is like the above, which means that backButton.IsEnabled explicitly is set to false at startup in the event handler)

    I also removed a call to

    ApplicationData.Current.LocalFolder.CreateFileAsync("startuplog.txt", CreationCollisionOption.ReplaceExisting);

    in App.xaml.cs that was left behind when I was debugging to get it through WACK locally.

    After these changes it worked.

    • Marked as answer by Epoch42 Sunday, January 20, 2013 3:11 PM
    Friday, January 11, 2013 9:51 AM

All replies

  • Hello,

    Would you please provide us the whole codes to reproduce this issue,

    You can upload your project to SkyDrive
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    If you don't want to upload the sample code, you can try to get the paid support from https://getsupport.microsoft.com/

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, January 03, 2013 5:56 AM
  • Thanks for your reply. I have gotten the app through certification now.

    I thought I'd follow up with what finally got the app working if others are facing similar problems.

    I made two changes before making the submit that got the app through certification: I changed the order of

     contentFrame.Navigated += contentFrame_Navigated;

    and

     contentFrame.Navigate(typeof(MainFrame));

    (so it is like the above, which means that backButton.IsEnabled explicitly is set to false at startup in the event handler)

    I also removed a call to

    ApplicationData.Current.LocalFolder.CreateFileAsync("startuplog.txt", CreationCollisionOption.ReplaceExisting);

    in App.xaml.cs that was left behind when I was debugging to get it through WACK locally.

    After these changes it worked.

    • Marked as answer by Epoch42 Sunday, January 20, 2013 3:11 PM
    Friday, January 11, 2013 9:51 AM