关闭导航堆栈在Windows 8应用程序弹出页面堆栈、弹出、应用程序、页面

由网友(生活如此欠r)分享简介:在我看到有功能让你去后退/前进或到家的网页页面之间进行导航。不过,我需要的是能够回去,但跳过用户不应该能够访问任何页面。我搜索了一圈,发现了以下内容:http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/3819f389-3bfc-...

在我看到有功能让你去后退/前进或到家的网页页面之间进行导航。不过,我需要的是能够回去,但跳过用户不应该能够访问任何页面。我搜索了一圈,发现了以下内容:http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/3819f389-3bfc-4c59-a919-272927fc9229

In navigating between pages I see that there are functions letting you go back / forward or to the 'home' page. However, what I need is to be able to go back but skip over pages that the user shouldn't be able to visit any more. I searched around and found the following: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/3819f389-3bfc-4c59-a919-272927fc9229

我试着用GetNavigationStack,但它一直未能由于不能够序列化和对象我传递的NavigationParameter。我在使用元组来传递2个参数,但这不能被序列化,所以我不能让导航堆栈需要手动编辑和删除的网页。

I tried using GetNavigationStack, but it keeps failing due to not being able to serialize and object I pass as the NavigationParameter. I'm having to use a Tuple to pass 2 parameters, but this can not be serialized and so I can not get the Navigation Stack to edit it and remove the pages manually.

然后我发现这个WinRT - 如何忽略或导航记录删除页面,以为我可能包括可以设置当页面被跳过了一个布尔值

I then found this WinRT - How to ignore or delete page from navigation history and thought I could include a boolean value that could be set if the page was to be skipped over

LayoutAwarePage.cs (类所有的屏幕从继承,由Visual Studio生成的)我说保护布尔CanGoBackToThisPage {获得;组; } 可如果你不想访问该网页,但也有这个问题,因为有时我不知道,如果你希望能够访问一个页面再次,直到你可以设置做了一些当前页上。我不认为你可以这样做 previousFrame.CanGoBackToThisPage = TRUE 。此外,框架对象,您可以访问没有(我认为)有机会获得实际的页面对象,但一些总结对象,而不是,我不知道我怎么倒是去获得这个布尔到该汇总对象。

In LayoutAwarePage.cs (the class all screens inherit from, generated by Visual Studio) I added protected bool CanGoBackToThisPage { get; set; } which can be set if you don't want to visit this page, but there is also a problem with this as some times I wont know if you want to be able to visit a page again until you have done something on the current page. I don't think you can do something like previousFrame.CanGoBackToThisPage = true. Also, the Frame object you have access to doesn't (I think) have access to the actual page objects, but some summary object instead and I don't know how I'd go about getting this boolean into that summary object.

有谁知道一个简单的方法来去除导航堆栈的previous /当前页面?这似乎是这将是一个非常普遍的问题,所以我很难认为微软并没有给我们做的一些方法。

Does anyone know of a simple way to remove the previous / current page from the navigation stack? This seems like it would be a really common problem so I struggle to think Microsoft hasn't given us some way of doing it.

感谢

推荐答案

好吧,我不知道为什么我没想到它张贴问题之前。也许我只是累了。

Ok, I don't know why I didn't think of it before posting the question. Maybe I'm just tired.

我只是叫 Frame.GoBack()两次,然后导航到我想去的页面:

I just called Frame.GoBack() twice and then navigated to the page I want to go to:

// If the user presses back we don't want them to visit this page or the previous page they were on so remove them from the navigation stack
Frame.GoBack();
Frame.GoBack();

// Go to the detail page
this.Frame.Navigate(typeof(GroupDetailPage), mGroup);

我猜我想叫 GoBack的()实际上使页面动画到previous之一,但它没有

I guess I thought calling GoBack() would actually make the page animate to the previous one, but it doesn't

阅读全文

相关推荐

最新文章