简介 Prism是一个用于WPF、Xamarin Forms、WinUI等的MVVM框架,刚刚学习,这里只是个人总结的一些知识点笔记。
IoC IContainerProvider
1 2 3 4 protected override Window CreateShell() { return Container.Resolve<MainWindow>(); } 1 2 3 4 5 6 public void OnInitialized(IContainerProvider containerProvider) { var regionManager = containerProvider.Resolve<IRegionManager>(); var viewA = containerProvider.Resolve<ViewA>(); ... } IContainerRegistry
1 2 3 4 5 6 7 8 9 // App.xaml.cs protected override void RegisterTypes(IContainerRegistry containerRegistry) { containerRegistry.Register<IApplicationCommands, ApplicationCommands>(); containerRegistry.RegisterDialog<NotificationDialog, NotificationDialogViewModel>(); containerRegistry.RegisterForNavigation<Page1>(); containerRegistry.RegisterForNavigation<Page2>(); ... } Module IModule
...