你好在UWP我可以导航到另一个页面,如:
Frame.Navigate(typeof(AnotherPage), someObject);
在AnotherPage
如果我想要检索的对象:
protected override void OnNavigationTo(NavigationEventArgs e) { SomeObject someObject = (SomeObject) e.Parameter; //here I would like to know from what page I am navigating }
你能告诉我如何从我浏览的页面中找到答案吗?谢谢.
导航完成后,将前一页放在Frame的BackStack上,只需查询该集合即可.
protected override void OnNavigatedTo(NavigationEventArgs e) { SomeObject someObject = (SomeObject)e.Parameter; PageStackEntry previousPage = Frame.BackStack.Last(); Type previousPageType = previousPage?.SourcePageType; base.OnNavigatedTo(e); }