使用PrismApplication
首先修改 App.xaml
引入PrismApplication命名空间
xmlns:unity="http://prismlibrary.com/"
<unity:PrismApplication
xmlns:unity="http://prismlibrary.com/"
x:Class="WpfApp3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApp3" >
<Application.Resources>
</Application.Resources>
</unity:PrismApplication>
在后置代码中实现CreateShell和RegisterTypes功能
public partial class App :PrismApplication
{
protected override Window CreateShell()
{
return Container.Resolve<FirstWindow>();
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
}
}