void rootFrame_Navigated(object sender, NavigationEventArgs e)
{
#if NETFX_CORE
object page = ((Frame)sender).Content;
#else
object page = rootFrame.Content; //((NavigationService)sender).CurrentSource;
#endif
if (page != null)
{
((FrameworkElement)page).OnFirstFrame(() =>
{
//We delay this call until we know the page has rendered. This helps to ensure this call fires only after navigation has completed.
SetVariables(null); //clear previous vars so they don't interfere w/ the next page
#if NETFX_CORE
LoadAutomaticNavigationProperties(page, e.Parameter);
#else
object param = null;
if (page is PhoneApplicationPage)
param = ((PhoneApplicationPage)page).NavigationContext;
LoadAutomaticNavigationProperties(page, param);
#endif
ReportPageNavigation(page, e.NavigationMode);
});
}
}