Location>code7788 >text

Prism: Framework Introduction and Installation

Popularity:13 ℃/2024-08-28 19:53:33

Prism: Framework Introduction and Installation

What is Prism?

Prism is a framework for building loosely coupled, maintainable and testable XAML applications in WPF, Xamarin Form, Uno Platform and WinUI.

Github

/PrismLibrary/Prism

NuGet

/packages/

image-20240827214423498

VS2022 Expansion

image-20240827213927843

image-20240827214402577

Features: MVVM, dependency injection, regions, navigation, modules, dialogs, publish and subscribe.

Manually created

1. Create a .NetFramework program or .

2. Installation in Nuget (note the version number)

3. Modify the file, add prism namespace, inherited from Application->PrismApplication, as follows.

image-20240827215959952

Open the file, inherited from Application->PrismApplication, as follows.

image-20240827220324023

Implement the abstract class as follows:

image-20240827220403770

Here, we implement two of these abstract methods.

This method returns a window of type Window, which is actually the main window of the application.

image-20240827220724371


This method is used during the initialization of Prism to define some of our own needs.enrollmenttype, so that it can be used in Prism.

Start the program:

image-20240827220851304

Two forms appear, just delete the StartupUri in it.

image-20240827220956996

autocreate

image-20240827214402577

After installing the expansion pack, you can choose to create an empty template.The default is .netCore and the Prism package is also version 8.1.97

image-20240827221623338

image-20240827221648242