WPF and XAML

dotnet add package yocto.Wpf

Register at startup:

using Yocto;

public partial class App : System.Windows.Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        Yocto.Application.Current.RegisterModule<ViewModelsModule>();
        base.OnStartup(e);
    }
}

Resolve in XAML:

<Window xmlns:yocto="https://github.com/MILL5/yocto"
        xmlns:vm="clr-namespace:MyApp.ViewModels"
        DataContext="{yocto:Resolve {x:Type vm:MainViewModel}}">

ResolveExtension also accepts Key for keyed registrations and Container to resolve from a container other than Application.Current. It returns null if the service isn’t registered, so the designer keeps working.

Next: Validation and Native AOT →

Last reviewed October 13, 2026 · yocto 3.0.0