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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CCSWE.Avalonia.ViewLocator" Version="12.0.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CCSWE.Avalonia.ViewLocator" Version="12.0.11" />
                    
Directory.Packages.props
<PackageReference Include="CCSWE.Avalonia.ViewLocator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CCSWE.Avalonia.ViewLocator --version 12.0.11
                    
#r "nuget: CCSWE.Avalonia.ViewLocator, 12.0.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CCSWE.Avalonia.ViewLocator@12.0.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CCSWE.Avalonia.ViewLocator&version=12.0.11
                    
Install as a Cake Addin
#tool nuget:?package=CCSWE.Avalonia.ViewLocator&version=12.0.11
                    
Install as a Cake Tool

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 ViewModelsViews 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.0.11 30 6/23/2026
12.0.10 30 6/23/2026
12.0.9 34 6/23/2026
12.0.8 41 6/23/2026
12.0.7 37 6/23/2026
12.0.6 162 6/9/2026
12.0.4 94 6/9/2026
12.0.3 98 6/8/2026
12.0.1 96 6/8/2026