Introduction
Dreamine.MVVM.Locators provides View-to-ViewModel binding infrastructure for WPF applications using the Dreamine MVVM framework.
This library provides a lightweight ViewModel locator implementation that supports both convention-based ViewModel resolution and dependency injection integration.
It allows Views to automatically obtain their corresponding ViewModel instances without breaking the MVVM pattern.
Main Components
- Lightweight ViewModel locator infrastructure
- Convention-based View ↔ ViewModel resolution
- Optional dependency injection integration
- Manual ViewModel registration support
- Automatic assembly scanning and registration
- Reverse View resolution from ViewModel
Key Features
- Convention Mapping: Resolves ViewModels based on namespace and naming conventions
- DI Integration: Uses a resolver when dependency injection is available
- Manual Registration: Supports explicit View ↔ ViewModel registration
- Assembly Scanning: Can auto-register mappings from assemblies
- Reverse Resolution: Can resolve a View type from a ViewModel type
Mapping Convention
.Views. -> .ViewModels.
View -> ViewModel
Example:
DreamineApp.Views.Login.MainWindow
->
DreamineApp.ViewModels.Login.MainWindowViewModel
Dependency Injection Support
If a resolver exists:
resolver.Resolve(vmType);
Otherwise:
Activator.CreateInstance(vmType);
Usage Example
Register resolver:
ViewModelLocator.RegisterResolver(new MyResolver());
Manual mapping:
ViewModelLocator.Register(typeof(MainWindow), typeof(MainWindowViewModel));
Resolve ViewModel:
var vm = ViewModelLocator.Resolve(typeof(MainWindow));
Resolve View:
var view = ViewModelLocator.ResolveView(typeof(MainWindowViewModel));
Auto register:
ViewModelLocator.RegisterAll(Assembly.GetExecutingAssembly());
Design Goals
Dreamine.MVVM.Locators is designed around the following principles:
- maintain automatic ViewModel resolution without breaking MVVM separation
- support both convention-based and explicit registration approaches
- allow dependency injection integration without forcing it
- keep the runtime structure lightweight and practical
- simplify View ↔ ViewModel composition in WPF applications
Architecture Role
Within the Dreamine MVVM ecosystem this package acts as the binding bridge between Views and ViewModels.
Related Modules
Dreamine.MVVM.Locators is typically used together with:
- Dreamine.MVVM.Interfaces
- Dreamine.MVVM.ViewModels
- Dreamine.MVVM.Wpf
Requirements
- .NET: net8.0
- WPF application environment
Version History
| Date | Version | Author | Description |
| 2025-05-26 | 1.0.0 | Jang Minsu | Initial commit for Dreamine.MVVM.Locators |
| 2025-05-26 | 1.0.1 | Jang Minsu | Started versioning from 1.0.1 due to existing NuGet.org lock on 1.0.0 |
| 2025-05-26 | 1.0.2 | Jang Minsu | Updated package metadata for Dreamine.MVVM.Locators 1.0.2 |
| 2025-05-30 | 1.0.3 | Jang Minsu | Added automatic ViewModelLocator registration support for Smart-compatible structure |
| 2025-06-01 | 1.0.4 | Jang Minsu | Improved ViewModel ↔ View mapping and introduced Region-based binding support |
| 2026-03-09 | 1.0.4 | Jang Minsu | Initialized repository documentation |
| 2026-03-09 | 1.0.4 | Jang Minsu | Fixed Korean README link formatting |
| 2026-03-15 | 1.0.4 | Jang Minsu | Corrected Interfaces reference path in repository documentation |
License
MIT License
Contact
Organization: Dreamine