Upgrade Guide
Current release: Crystal.Avalonia 3.1.0
Versioning from 3.0.0: 3.0.x is bug fixes only. New abstractions go to 3.1+. Breaking changes go to 4.0. (2.0.1 removed CreateShellFromDi in a patch — that will not be repeated.)
| From | Guide |
|---|---|
| 3.0.x | Upgrade from 3.0 — instance CrystalOptions / ConfigureOptions |
| 2.0.x | Upgrade from 2.0 — instance MvvmManager, EnableViewLocator, OnLoadedAsync(bool) |
| 2.0.0 | First apply Upgrade from 2.0.0, then 3.0 / 3.1 |
| 1.2.x | Upgrade from v1.2 then Upgrade from 2.0 |
Quick Reference (3.1.0)
public override void ConfigureOptions(CrystalOptions options)
{
options.EnableViewLocator = true; // default
}
public override void RegisterServices(IServiceCollection services)
{
services.AddMvvmTransient<MainView, MainViewModel>();
}
public override void CreateShell(IServiceProvider sp)
{
CreateShell<MainWindow, MainView>();
}
- ViewModel → DI (
AddMvvm*) - View → mapping on
CrystalApplication.Mvvm; created by XAML orViewLocator - Shell →
CreateShell<...>()withnew, not DI ConfigureOptions/CrystalApplication.Options→ ViewModel-firstDataTemplates(EnableViewLocator) and other framework flags; also DI singleton