none
Load selected page before navigating to it

    Question

  • Hello!

    I am new to windows 8 programming and really trying to get a strong hold on 'async' and 'await' and for now my app is complete but my page transitions and how they load is really not good. Now keep in mind also that I am not using the MVVM model this time around because I already finished the app this way but I will will move to that style the second time around.

    What my problem is when a user clicks button to navigate it goes but the page slides all the objects onto the page or they take a second to load onto the page. SO what I want to do is either implement a loading bar or in the OnNavigatedTo method I would load the page and in Blend add a different page transition so maybe they can fade in or pop up or whatever other options there are.

    Here is the code I have for page navigation right now:

    private void ArcadePage_Tapped_1(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
            {
                var page = new Mode1();
                Window.Current.Content = page;
                Sound.Play(); //sound to play on button click
                MainPageMusic.Stop(); //music on main page to stop
            }

    This is for a game so anything to make this as fluid and cool as possible would be great. Any help or sample code to get me started would be great guys.

    thanks

    Saturday, June 29, 2013 4:20 PM

All replies

  • The question is:  what's causing the page load to take so long?  If you're downloading content, then you should be waiting for that to complete.  If something else, please describe here.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, July 01, 2013 1:18 PM
    Moderator
  • Yes the images are taking long to load. I saw that with the WinRT toolkit we can suspend the page from moving forward until its all loaded up and also using async and await to load up that content but I am unable to use the 'alternative page' item and not sure how to use async and await for this case.
    Thursday, July 04, 2013 12:55 AM