清除 NavigationService 中的前向条目

发布于 2024-09-01 01:22:36 字数 371 浏览 4 评论 0原文

我有一个托管在 WPF NavigationWindow 中的小型示例应用程序。 它具有三个页面(A、B、C),并且用户可以使用三个按钮:导航窗口上的“后退”和“前进”以及第一页上的“下一步”。

第一页 A 包含两个单选按钮。根据用户选择的按钮,下一步按钮将导航到页面 B 或页面 C。

问题是当用户使用导航窗口上的后退按钮时,更改第一页上的选择并点击前进按钮而不是下一步按钮。下一个事件处理程序将重新评估逻辑并移动到正确的页面,但“前进”按钮只是从前进堆栈中获取一个页面。

在这种情况下建议采取什么行动?我在 MSDN 上找不到此类场景的任何详细信息。我相信解决此问题的最简单原因是当用户更改第一页上的选择时清除前向堆栈,因此只有“下一步”按钮可用。不幸的是我不知道该怎么做。

I have a small sample application hosted in WPF NavigationWindow.
It has three pages (A, B, C) and three buttons are available to the user: Back and Forward on Navigation Window and Next on the first page.

The first page A contains two radio buttons. Depending which button has been selected by the user Next button will navigate to page B or page C.

The problem is when the user uses Back button on the NavigationWindow, change the selection on the first page and hit Forward button instead of Next button. Next event handler would reevaluate the logic and move to the proper page, but Forward button just get a page from the forward stack.

What is the recommend action in such situation? I couldn't find any details of such scenario on MSDN. I believe the easiest why to resolve this issue would be to clear forward stack when the user changed selection on the first page so only Next button is available. Unfortunately I don't know how to do it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安穩 2024-09-08 01:22:36

试图解决非常相似的问题。尚未使其正常工作,但我正在寻找 WPF PageFunctions。

您可以通过下面的链接找到有关页面功能的详细描述,以及我看到的有关 WPF 导航的最佳概述

http://www.paulstovell.com/wpf-navigation

您还可以使用导航事件处理程序抑制向前导航。请参阅NavigationService 何时初始化?

Trying to resolve quite similar problem. Not yet make it working, but I'm looking to WPF PageFunctions.

A good description of page functions you can find by the link below, as well as greatest overview on WPF navigation I saw

http://www.paulstovell.com/wpf-navigation

Also you can suppress forward navigation using Navigating event handler. See When is NavigationService initialized?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文