第一步:
1、MEFtest项目,添加Shell.XAML文件,删除App.xaml中的启动项 (去掉这一句:StartupUri="MainWindow.xaml") 。
2、添加NugGet包,Prism.MEFExtensions,Prism.Mef
3、在Shell.XAML中添加Window中的xmlns:prism="http://www.codeplex.com/prism"和Grid中的
<Grid>
<DockPanel LastChildFill="True">
<ContentControl prism:RegionManager.RegionName="MainRegion" DockPanel.Dock="Top"/>
</DockPanel>
</Grid>
第二部步:新建Bootstrapper类,Bootstrapper继承MEFBootstrapper,
添加引用
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;