在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