Prism框架
什么是Prism框架
Mvvm設(shè)計模式開發(fā)應(yīng)用的一個框架。
Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Windows 10 UWP, and Xamarin Forms.
最初是由微軟Patterns & Practices團隊開發(fā)的項目,目的在于幫助開發(fā)人員構(gòu)建松散耦合的猜欺、更靈活殊霞、更易于維護并且更易于測試的WPF應(yīng)用或是Silverlight應(yīng)用以及Windows Phone 7應(yīng)用矗蕊。
現(xiàn)在已經(jīng)開源在github上前酿,項目地址是:https://github.com/PrismLibrary/Prism
怎么使用這個框架
1.安裝
目前最近版本是7.2癣朗,需要vs2017蜗元、vs2019支持或渤。老版本已經(jīng)不維護了。
在安裝擴展的位置搜索Prism奕扣,安裝Prism Template Pack這個擴展就可以了薪鹦。
2.項目item介紹
空的應(yīng)用程序中包括兩個文件夾Views和ViewModels,分別存儲xaml文件和試圖邏輯類文件惯豆。
App.xaml文件是項目啟動相關(guān)的文件池磁。
Dependencies中包括項目的引用和包文件,默認(rèn)引用包含如下:
<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>