Prism框架
什么是Prism框架
Mvvm设计模式开发应用的一个框架。
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Windows 10 UWP, and Xamarin Forms.
最初是由微软Patterns & Practices团队开发的项目,目的在于帮助开发人员构建松散耦合的、更灵活、更易于维护并且更易于测试的WPF应用或是Silverlight应用以及Windows Phone 7应用。
现在已经开源在github上,项目地址是:https://github.com/PrismLibrary/Prism
怎么使用这个框架
1.安装
目前最近版本是7.2,需要vs2017、vs2019支持。老版本已经不维护了。
在安装扩展的位置搜索Prism,安装Prism Template Pack这个扩展就可以了。
2.项目item介绍
空的应用程序中包括两个文件夹Views和ViewModels,分别存储xaml文件和试图逻辑类文件。
App.xaml文件是项目启动相关的文件。
Dependencies中包括项目的引用和包文件,默认引用包含如下:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>LoginDemoForPrismWpf</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Prism.Unity" Version="7.2.0.1367" />
</ItemGroup>
</Project>