CCSWE.Avalonia.ViewLocator
12.0.11
dotnet add package CCSWE.Avalonia.ViewLocator --version 12.0.11
NuGet\Install-Package CCSWE.Avalonia.ViewLocator -Version 12.0.11
<PackageReference Include="CCSWE.Avalonia.ViewLocator" Version="12.0.11" />
<PackageVersion Include="CCSWE.Avalonia.ViewLocator" Version="12.0.11" />
<PackageReference Include="CCSWE.Avalonia.ViewLocator" />
paket add CCSWE.Avalonia.ViewLocator --version 12.0.11
#r "nuget: CCSWE.Avalonia.ViewLocator, 12.0.11"
#:package CCSWE.Avalonia.ViewLocator@12.0.11
#addin nuget:?package=CCSWE.Avalonia.ViewLocator&version=12.0.11
#tool nuget:?package=CCSWE.Avalonia.ViewLocator&version=12.0.11
CCSWE.Avalonia.ViewLocator
A compile-time, AOT/trim-safe Avalonia ViewLocator. A Roslyn source generator pairs each FooViewModel with its
FooView by naming convention (same namespace, a ViewModels→Views namespace, or an assembly-wide search)
— with a [View] override — and resolves the view from your IServiceProvider — no reflection, no
hand-maintained map.
[GenerateViewLocator(typeof(ViewModelBase))]
public partial class ViewLocator;
The generator emits the entire IDataTemplate (ctor, Build, Match, and the view-model → view map) into the
partial — adding only the interface, never a base class. Register it like any data template:
DataTemplates.Add(new ViewLocator(serviceProvider));
Views are resolved via IServiceProvider.GetService(viewType), so register each view with your container
(e.g. services.AddTransient<EmulatorView>()).
See the repository for full usage and the convention details.
MIT © Cory Charlton / CCSWE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia (>= 12.0.0 && < 13.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.