It allows to leave your View code-behind entirely empty, without Interaction requests. You get a clean separation between the View and the ViewModels. You know the design is clean when all Views are empty of code.
It allows writing unit tests for view models in the same manner unit tests are written for other classes.
This matters especially in the era of AI building spaghetti code on auto-pilot. This allows you to entirely separate visual concerns from logic concerns. It forces AI to maintain a clean boundary that prevents spaghetti code creep.
It also gives you the possibility to switch the UI at any point with little efforts.
If you want to know what MVVM is and why it matters, check out my tutorial Build Modern Cross-Platform Apps with .NET. https
| Framework | Targets | NuGet |
|---|---|---|
| Avalonia | Desktop, Mobile, Browser | |
| WPF | Desktop | |
| WinUI 3 | Windows | |
| MAUI | Desktop, Mobile | |
| Uno | Desktop, Mobile, Browser |
- Modal and child windows
- Recursive closure confirmation and veto
- File dialogs and access
- Message boxes and popups
- Single-page navigation mode and back button for mobile
- ViewModel as document tabs, or as dock panels, with custom implementation
This documentation is for v3; v2.4 is here..
The interface IDialogService provides a platform-agnostic way of managing dialogs:
using HanumanInstitute.MvvmDialogs
public class BaseViewModel : INotifyPropertyChanged
{
private readonly IDialogService dialogService;
public BaseViewModel(IDialogService dialogService)
{
this.dialogService = dialogService;
}
// ...
private async Task ShowDialogAsync()
{
var vm = dialogService.CreateViewModel<AddTextViewModel>();
bool? success = await dialogService.ShowDialogAsync(this, vm);
if (success == true)
{
Results.Add(vm.Text);
}
}
}Meanwhile...
- You can use IDialogService within class libraries that have no reference to Avalonia nor Wpf (referencing only
HanumanInstitute.MvvmDialogs) - It is friendly for unit tests
- ViewLocator
- ViewModels
- Dialogs
- CollectionView
- Templates
- Testing and logging
- Mvvm for Avalonia
- Mvvm for WPF
- Mvvm for WinUI3
- Mvvm for MAUI
- Mvvm for Uno
- Agentic coding
Demos are available for all platforms.
Beginner: Quickstart showing basic usage.
Intermediate: Gallery showing all common features.
Advanced: Workspace showing views in tabs and dock panels.
Pro: PhotoCraft controlling an external app from ViewModel via custom IView.
The original design came from FantasticFiasco/mvvm-dialogs. Migration guide
Etienne Charland — Coherence Programming | Reality Engineering | Soul Architect
Consulting services available — including a free architectural coherence scan.