好吧,我目前正在构建一个 WinRT 应用程序,我正面临这个问题。
我想要实现的是我需要读取或修改我从中导航的上一页上的属性。
因此,假设我有两个页面:MainPage
和WatchPage
.
我正在WatchPage
从事件导航到事件MainPage
内部和WatchPage's
OnNavigatedTo
事件内部,我需要在MainPage
不使用导航参数的情况下访问内部属性...
我怎样才能做到这一点?
protected override void OnNavigatedTo(NavigationEventArgs e){
Type LastPage = rootFrame.BackStack.Last().SourcePageType;
if(LastPage == typeof(MainPage){
// here, for example, say that MainPage has a property called isLoadSuccess
// I need to set that property to false
// or call a method from MainPage
// => this is not working MainPage MP = LastPage as MainPage;
// I know that it should not work anyway, but, how can I achieve this?
}
}