locked
How to efficiently communicate between default page and PageControl elements? RRS feed

  • Question

  • 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?
    Saturday, August 18, 2012 3:00 AM

Answers

All replies

  • 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 12:13 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.
    Monday, August 20, 2012 6:27 PM