OutWit.Common.MVVM.Navigation.Avalonia 1.0.0

dotnet add package OutWit.Common.MVVM.Navigation.Avalonia --version 1.0.0
                    
NuGet\Install-Package OutWit.Common.MVVM.Navigation.Avalonia -Version 1.0.0
                    
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="OutWit.Common.MVVM.Navigation.Avalonia" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OutWit.Common.MVVM.Navigation.Avalonia" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="OutWit.Common.MVVM.Navigation.Avalonia" />
                    
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 OutWit.Common.MVVM.Navigation.Avalonia --version 1.0.0
                    
#r "nuget: OutWit.Common.MVVM.Navigation.Avalonia, 1.0.0"
                    
#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 OutWit.Common.MVVM.Navigation.Avalonia@1.0.0
                    
#: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=OutWit.Common.MVVM.Navigation.Avalonia&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=OutWit.Common.MVVM.Navigation.Avalonia&version=1.0.0
                    
Install as a Cake Tool

OutWit.Common.MVVM.Navigation.Avalonia

The Avalonia half of OutWit.Common.MVVM.Navigation. Runnable sample: OutWit.Common.MVVM.Navigation.Avalonia.Sample.

  • ViewLocator — an IDataTemplate and the core's IViewFactory: the view registry first (the only path under trimming/AOT), then a naming convention searched in the view model's own assembly, so module assemblies are found. Created from DI so views may take dependencies.
  • NavigationOutlet — a control that hosts an INavigationOutlet and owns the views: for Cached routes the view of each view model survives navigations (scroll position, column widths, expensive controls), for Transient routes it goes with the view model. Set TransitionDuration to fade between screens; the fade is on the outlet itself, so a cached view is never asked to be in two places at once, and a fade that is overtaken hands over cleanly.
  • DialogHostWindow / DialogHostOverlayIDialogHost implementations without external dependencies: modal windows (nest) or a dimmed overlay on the active window (one at a time).
  • IApplicationResources — lets a UI module add its styles and resource dictionaries.
  • AddAvaloniaNavigation() — registers all of the above plus AvaloniaDispatcher as IDispatcher.

Setup

// App.axaml.cs, OnFrameworkInitializationCompleted
var services = new ServiceCollection();

services.AddNavigation(nav =>
{
    nav.AddRoute<StudiesViewModel>(Routes.STUDIES);
    nav.AddRoute<StudyViewModel>(Routes.STUDY, NavigationRouteMode.Transient);
});
services.AddAvaloniaNavigation(o => o.UseOverlayDialogs());     // or UseWindowDialogs() (default)
services.AddSingleton<ShellViewModel>();

var provider = services.BuildServiceProvider();
provider.UseAvaloniaViewLocator();                               // Application.DataTemplates
provider.ValidateNavigation(throwOnProblems: Debugger.IsAttached);

desktop.MainWindow = new ShellWindow { DataContext = provider.GetRequiredService<ShellViewModel>() };
await provider.GetRequiredService<INavigationService>().NavigateAsync(Routes.STUDIES);

<Window xmlns:n="https://schemas.outwit.io/navigation">
  <Grid ColumnDefinitions="Auto,*">
    <ItemsControl ItemsSource="{Binding NavigationBar.Items}" />     
    <n:NavigationOutlet Grid.Column="1" Outlet="{Binding Main}" />   
  </Grid>
</Window>

ShellViewModel exposes Main (navigation.Outlet()) and NavigationBar (contributions.Zone(Zones.NAVIGATION_BAR)). No statics, no attached property with a region name, no service lookup from a control.

Views

Convention (ViewConvention) App.ViewModels.StudyViewModel
ViewModelsToViews (default) App.Views.StudyView, then App.ViewModels.StudyView
SameNamespace App.ViewModels.StudyView
None registry only

Explicit registration always wins: nav.AddView<StudyViewModel, StudyView>() or context.Views.Register<StudyViewModel, StudyView>() from a module.

The convention searches the view model's own assembly. Views that live in a different assembly from their view models — a shared view model layer, a per-platform view layer — have to be registered explicitly. That is also the only path that survives trimming.

Dialogs

Both hosts route every UI-initiated close — the window's close button, a click on the overlay backdrop, Escape — through the dialog's CanCloseAsync. Style the generated window with the navigation-dialog class and the overlay with navigation-dialog-overlay. For Material.Avalonia there is a ready adapter: OutWit.Common.MVVM.Navigation.Avalonia.DialogHost, kept in its own package so this one carries no dependency on it. Any other dialog library is an IDialogHost of your own passed to UseDialogHost<T>().

License

Apache-2.0. Part of the OutWit ecosystem.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OutWit.Common.MVVM.Navigation.Avalonia:

Package Downloads
OutWit.Common.MVVM.Navigation.Avalonia.DialogHost

Shows OutWit.Common.MVVM.Navigation dialogs through DialogHost.Avalonia, for applications already themed with Material.Avalonia. A separate package so that the navigation packages themselves keep no dependency on it: pick this host with UseDialogHost<DialogHostAvaloniaAdapter>() and nothing else changes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 127 8/23/2026