删除导航服务上的转发条目? [英] Remove forward entry on Navigation service?

查看:62
本文介绍了删除导航服务上的转发条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除导航服务中的所有转发条目?

How would one remove all the forward entries in a navigation service?

我尝试过,但是它崩溃了.

I tried this but it is crashing.

    while (NavigationService.CanGoForward) NavigationService.RemoveBackEntry();

我知道"RemoveBackEntry()"看起来很奇怪,但是没有RemoveForwardEntry()方法.

I know "RemoveBackEntry()" seems odd but there is no RemoveForwardEntry() method.

有什么想法吗?

谢谢, 可汗

修改1: 我稍微靠近一点,我可以访问前向堆栈,甚至在那里输出每个项目,但是我似乎无法解决如何删除条目的问题. _frame.ForwardStack或j上的任何属性或方法都无法深入了解如何删除这些条目.

Edit 1: Im a little closer, i can access the forward stack, and even output each item in there but i can not seem to work out how to remove the entries. None of the properties or methods on _frame.ForwardStack or j give any insight into how to remove these entries.

        Window mainWindow = Application.Current.MainWindow;
        Frame _frame = (Frame)mainWindow.FindName("mainFrame");
        foreach (JournalEntry j in _frame.ForwardStack)
        {
            MessageBox.Show(j.Name);
        }

推荐答案

我进一步阅读了wpf导航,如果可以找到应用程序的NavigationWindow实例,则有一个名为ForwardStack的属性,该属性保存以下内容的列表:转发导航页面.您应该能够在此处添加或删除页面.

I read into the wpf navigation a little more and if you can get to the instance of NavigationWindow for your application there is a property called ForwardStack that holds the list of forward navigation pages. You should be able to add or remove pages from there.

我还没有尝试过这个,因为我现在还没有一个项目可以对此进行测试,所以请让我知道它是否可以正常工作,因为我将来想尝试一下.

I have not tried this myself as I do not have a project to test this on right now so let me know if this works as I would like to try this myself in the future.

请参阅msdn链接以获取完整的成员列表: http://msdn.microsoft.com/zh-CN /library/system.windows.navigation.navigationwindow_members.aspx

See msdn link for full member listing: http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationwindow_members.aspx

这篇关于删除导航服务上的转发条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆