https://www.bilibili.com/video/BV1nY411a7T8?p=14
添加Prism.DryIoc包引用
修改app.xaml代码
<prism:PrismApplication x:Class="WPF01.App" xmlns:prism="http://prismlibrary.com/" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WPF01" > <Application.Resources> </Application.Resources> </prism:PrismApplication>
public partial class App : PrismApplication { protected override Window CreateShell() { return Container.Resolve<MainWindow>(); } protected override void RegisterTypes(IContainerRegistry containerRegistry) { } }
避免以后每次都修改,需要安装在项目模板,方式如下:
运行
本文来自博客园,作者:董锡振,转载请注明原文链接:https://www.cnblogs.com/dongxizhen/p/16500563.html