在 Wpf 应用程序中使用 Prism 进行导航 [英] Using Prism for navigation in Wpf application

查看:46
本文介绍了在 Wpf 应用程序中使用 Prism 进行导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Wpf 中开始一个新项目,现在正在考虑使用 Prism.现在我只是尝试使用 Prism 设置应用程序的导航.不幸的是,我缺乏该框架的经验,因此入门有点困难..

I'm starting a new project in Wpf, and am now looking into using Prism. For now I'm simply trying to set up the navigation of the application using Prism. Unfortunately my lack of experience with the framework makes it a bit difficult to get started..

为了更准确地描述我的第一个挑战,我有一个带有导航/菜单"区域和主"区域的应用程序.对于所有不同的主要区域视图,导航区域都是相同的,因此我在 shell.xaml 中定义了菜单.单击任何菜单项时,我想使用 Prism 向该区域添加视图.第一的;这是一个通常会使用棱镜的东西吗?如果是这样;典型的方法是什么?我的意思是在结构层面上..

To be more precise about my first challenge I have an application with a "navigation/menu" region and a "main" region. The navigation region will be the same for all different main region views, and I therefore define the menu in the shell.xaml. When clicking any menu item I'd like to add a view to the region using Prism. First; is this something one typically will use Prism for? If so; what's the typical approach? And I mean on a more structural level..

我的印象是 Prism 最终将使我的应用程序更具可扩展性,并且我发现我从中获得了一些其他优势 - 例如 IoC 容器.所以我想使用它 - 如果我只能完成第一步..

My impression is that Prism will make my application much more scalable in the end, and I see that I get some other advantages from it - like the IoC container. So I would like to use it - if I could only get through the first steps..

推荐答案

我有一个示例,它使用了更多的 CAG 感觉,用于为菜单做出贡献的模块以及如何向区域添加视图.它应该让事情更清楚一点.

I've got a sample that uses a little more of the CAG feel for modules contributing to a menu and how to add views to a region. It ought to make things a little more clear.

http://dl.getdropbox.com/u/376992/CAGMenus.zip

希望这会有所帮助,安德森

Hope this helps, Anderson

这篇关于在 Wpf 应用程序中使用 Prism 进行导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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