![]() |
VOOZH | about |
dotnet add package CastelloBranco.LocatorGenerator --version 3.0.2
NuGet\Install-Package CastelloBranco.LocatorGenerator -Version 3.0.2
<PackageReference Include="CastelloBranco.LocatorGenerator" Version="3.0.2" />
<PackageVersion Include="CastelloBranco.LocatorGenerator" Version="3.0.2" />Directory.Packages.props
<PackageReference Include="CastelloBranco.LocatorGenerator" />Project file
paket add CastelloBranco.LocatorGenerator --version 3.0.2
#r "nuget: CastelloBranco.LocatorGenerator, 3.0.2"
#:package CastelloBranco.LocatorGenerator@3.0.2
#addin nuget:?package=CastelloBranco.LocatorGenerator&version=3.0.2Install as a Cake Addin
#tool nuget:?package=CastelloBranco.LocatorGenerator&version=3.0.2Install as a Cake Tool
CastelloBranco.LocatorGenerator is a source generator designed to automatically generate the necessary code to locate and instantiate ViewModels marked with a special attribute in Avalonia projects.
Inports nuget Package AutoRegisterInject and decorate yours views and viewmodels with
[RegisterTransient] [RegisterSingleton] [RegisterScoped] [RegisterHostedService]
This tool scans projects for classes and generates a ViewLocator.g.cs file to resolve and inject dependencies automatically using the CommunityToolkit.Mvvm library.
NuGet Package:
1) Add nuget packeges to the project that will use the generated locator.
Microsoft.Extensions.DependencyInjection;
CommunityToolkit.Mvvm
AutoRegisterInject
2) Add the `CastelloBranco.LocatorGenerator` package to the project that will use the generated locator.
[RegisterTransient] [RegisterSingleton] [RegisterScoped] [RegisterHostedService]
<UserControl
...
xmlns:l="using:your_root_namespace"
xmlns:views="using:your_Views_namespace_"
xmlns:vm="using:your_ViewModels_namespace_"
l:AutoWireViewModel.Enabled="True"
x:DataType="vm:MainViewViewModel"
>
<Application ...
xmlns:l="using:your_root_namespace"
... >
<Application.DataTemplates>
<l:ViewLocator />
</Application.DataTemplates>
MIT
Contributions are welcome! Please follow the pull request process and review our contribution policy.
Learn more about Target Frameworks and .NET Standard.
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.2 | 220 | 3/2/2025 |
| 3.0.1 | 172 | 3/2/2025 |
| 3.0.0 | 199 | 3/2/2025 |
| 2.2.55 | 186 | 3/1/2025 |
| 2.2.52 | 198 | 3/1/2025 |
| 2.2.51 | 174 | 3/1/2025 |
| 2.2.6 | 165 | 3/1/2025 |
| 2.2.5 | 192 | 3/1/2025 |
| 2.2.3 | 184 | 3/1/2025 |
| 2.2.1 | 186 | 3/1/2025 |
| 2.2.0 | 193 | 3/1/2025 |
| 2.1.9 | 210 | 3/1/2025 |
| 2.1.8 | 201 | 2/27/2025 |
| 2.1.7 | 192 | 2/27/2025 |
| 2.1.6 | 193 | 2/22/2025 |
| 2.1.5 | 184 | 2/14/2025 |
| 2.1.4 | 203 | 2/13/2025 |
| 2.1.3 | 442 | 2/11/2025 |
| 2.1.2 | 450 | 2/11/2025 |
| 2.1.1 | 459 | 2/11/2025 |