为 WPF 自定义导航创建容器
我有一个应用程序,其中有一个小面板需要支持浏览器(如导航),例如后退、前进和主页。因此,它还需要保存用户访问过的面板的历史记录。我认为我不能使用 NavigationWindow,因为只有一小部分窗口支持导航。
这样做的最佳实践是什么?我一直在研究 NavigationService 和 NavigateBack 等导航命令。但是将这些东西结合在一起有点困难。
我也在使用 Prism/MEF。
I have an app where there's a small panel that needs to support browser like navigation such has back, forward, and home. Thus it also needs to hold a history of panels the user has gone to. I don't think I can use NavigationWindow because only a small portion of the window will support navigation.
What is the best practice for doing this? I've been looking at NavigationService and the Navigation commands like NavigateBack and etc.. But it's kinda hard to tie this stuff together.
I'm using Prism/MEF as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用该地区的期刊。如果您获取区域管理器并获取对为面板定义的 Prism 区域实例的引用。然后就可以使用日记本的导航服务对该地区进行回去了。如果您需要在导航到下一个视图时执行某些操作,您还可以注册该区域的 NavigationService 的 Navigated 事件。
You need to use the Journal of the region. If you get the Region manager and get a reference to the Prism Region instance defined for the panel. Then you can use the Journal of the Navigation service for the region to go back. You can also register to the Navigated event of the NavigationService for the region if you need to perform some action when the next view is navigated to.