Prism8.0 (1): Project construction

Prism is an open source framework for building loosely coupled, maintainable and testable XAML applications in WPF and Xamarin Forms.

Method 1: Create manually

Create a .Net Framework or .Net Core WPF project. Note that the latest 8.0 only supports .Net Framework 4.6.2 and above.
Prism supports two dependency injection containers, DryIOC and Unity, by default. Here we use Unity directly and search in the NuGet package manager Prism.Unity.
Prism.Unity
Modify App.xamlas follows, use PrismApplication
App.xaml
rewrite method:

public partial class App
{
    
    
    protected override Window CreateShell()
    {
    
    
        return Container.Resolve<MainWindow>();
    }

    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
    
    

    }
}

Method 2: Create using templates

Search for Prism Template in the VS extension management and install the following extension.
Extension download
After the installation is complete, restart VS. When creating a new project, you can directly choose to use the Prism template to create it.
template
Just select the container you want to use when creating it.
Select container

Guess you like

Origin blog.csdn.net/qq_29242649/article/details/113694385