Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
How to efficiently communicate between default page and PageControl elements?

Answered How to efficiently communicate between default page and PageControl elements?

  • Saturday, August 18, 2012 3:00 AM
     
     
    I have the default.html page and a PageControl element. I want to receive data from an external source, process it by the default page, and then send the processed data to the PageControl element to display it. I did not find any suitable way to pass information from default to PageControl. Could you please suggest the options?

All Replies

  • Monday, August 20, 2012 12:13 PM
    Moderator
     
     Answered Has Code

    Hi

    First create a Namespace in your javascript file to store this data,

    WinJS.Namespace.define("ViewModel",{ UserData:WinJS.Binding.as({

    UserData1:null,

    UserData2:[];

    })

    });


    When this data be processed, save it in a global WinJS.Namespace like this:

    ViewModel.UserData.UserData1="abc";

    Or you can use session state:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh440965.aspx

  • Monday, August 20, 2012 6:27 PM
     
     
    Thanks! User-defined functions of WinJS.UI.Pages.define also look promising, so when data arrives I can route it to the scope I need.