What Prism Adds on Top of MVVM
Prism (maintained under the .NET Foundation, package Prism.Core plus platform packages like Prism.Wpf, Prism.Maui, and Prism.Uno) is an application framework, not merely an MVVM helper library. Where plain MVVM only describes the relationship between a view and a view model, Prism adds modularity through IModule and the module catalog, dependency injection via a container abstraction (DryIoc or Unity), region-based navigation for composing UI from independently developed parts, and IEventAggregator for loosely coupled cross-module communication.
Cricket analogy: Just as the IPL is not just eleven cricketers but an entire league structure of franchises, auctions, and broadcast rights layered on top of the sport itself, Prism is not just view-model binding but an entire application structure of modules, DI, and navigation layered on top of core MVVM.
Modules and Regions
A Prism module is an assembly (or logical unit) implementing IModule, whose RegisterTypes method registers its own services and views with the DI container and whose OnInitialized method performs startup logic; modules are declared in a ModuleCatalog and can be loaded eagerly at startup or lazily on demand, letting a large application be built and even deployed as independently developed, independently testable pieces. A region, declared in XAML with prism:RegionManager.RegionName on a ContentControl, ItemsControl, or TabControl, is a named placeholder that any module can navigate views into at runtime via IRegionManager.RequestNavigate, without the shell needing compile-time knowledge of which view will appear there.
Cricket analogy: Like an IPL franchise's scouting department independently signing and developing players who later slot into the main squad without the head coach designing each player's training from scratch, a Prism module independently registers its services and views, which then slot into the shell's regions.
public class OrdersModule : IModule
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<OrderListView, OrderListViewModel>();
containerRegistry.Register<IOrderService, OrderService>();
}
public void OnInitialized(IContainerProvider containerProvider)
{
var regionManager = containerProvider.Resolve<IRegionManager>();
regionManager.RequestNavigate("ContentRegion", "OrderListView");
}
}
// Shell.xaml
// <ContentControl prism:RegionManager.RegionName="ContentRegion" />IEventAggregator for Cross-Module Communication
IEventAggregator lets modules that have no reference to one another communicate through strongly typed PubSubEvent subclasses; a publisher calls eventAggregator.GetEvent<OrderPlacedEvent>().Publish(order) and any number of subscribers register with .Subscribe(handler), optionally specifying ThreadOption.UIThread so the callback marshals automatically back to the UI thread even if published from a background service. This is Prism's answer to the same decoupling problem CommunityToolkit.Mvvm solves with IMessenger, and the two are conceptually interchangeable though not directly compatible.
Cricket analogy: Like a stadium PA announcing a wicket has fallen so the scoreboard operator, the broadcast director, and the crowd all react independently without the bowler personally notifying each of them, IEventAggregator.Publish notifies every subscriber independently without the publisher knowing who they are.
Subscriptions made with the default ThreadOption.PublisherThread will invoke on whatever thread called Publish; if that is a background thread and the handler touches UI-bound properties, you must specify ThreadOption.UIThread when subscribing or manually marshal the call, otherwise you risk a cross-thread exception.
- Prism is a full application framework layered on MVVM, adding modularity, DI, region navigation, and event aggregation.
- IModule.RegisterTypes registers a module's services and views; OnInitialized runs its startup logic.
- Regions are named placeholders (RegionManager.RegionName) that modules navigate views into at runtime via IRegionManager.RequestNavigate.
- Prism supports DryIoc or Unity as pluggable dependency injection containers.
- IEventAggregator provides strongly-typed PubSubEvent-based communication between decoupled modules.
- ThreadOption.UIThread on Subscribe ensures the handler runs on the UI thread regardless of the publishing thread.
- Prism.Maui brings the same module, region, and navigation concepts to .NET MAUI applications.
Practice what you learned
1. What does a Prism module's RegisterTypes method typically do?
2. What is a Prism region?
3. Why would you specify ThreadOption.UIThread when subscribing to an IEventAggregator event?
4. Which two dependency injection containers does Prism officially support as pluggable backends?
5. How does Prism's IEventAggregator differ from CommunityToolkit.Mvvm's IMessenger conceptually?
Was this page helpful?
You May Also Like
MVVM Toolkit Overview
A practical introduction to CommunityToolkit.Mvvm, the source-generator-based library that eliminates boilerplate for ObservableObject, RelayCommand, and cross-platform messaging in .NET applications.
Caliburn.Micro Overview
An overview of Caliburn.Micro, the convention-based MVVM framework that automates view-viewmodel binding, actions, and screen conductors with minimal explicit wiring.
MVVM in .NET MAUI
How the MVVM pattern is applied in .NET MAUI using CommunityToolkit.Mvvm, XAML data binding, Shell navigation, and dependency injection to build cross-platform mobile and desktop apps.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics