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
<PackageReference Include="OutWit.Common.MVVM.Navigation.Avalonia" Version="1.0.0" />
<PackageVersion Include="OutWit.Common.MVVM.Navigation.Avalonia" Version="1.0.0" />
<PackageReference Include="OutWit.Common.MVVM.Navigation.Avalonia" />
paket add OutWit.Common.MVVM.Navigation.Avalonia --version 1.0.0
#r "nuget: OutWit.Common.MVVM.Navigation.Avalonia, 1.0.0"
#:package OutWit.Common.MVVM.Navigation.Avalonia@1.0.0
#addin nuget:?package=OutWit.Common.MVVM.Navigation.Avalonia&version=1.0.0
#tool nuget:?package=OutWit.Common.MVVM.Navigation.Avalonia&version=1.0.0
OutWit.Common.MVVM.Navigation.Avalonia
The Avalonia half of OutWit.Common.MVVM.Navigation. Runnable sample: OutWit.Common.MVVM.Navigation.Avalonia.Sample.
- ViewLocator — an
IDataTemplateand the core'sIViewFactory: 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
INavigationOutletand 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. SetTransitionDurationto 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 / DialogHostOverlay —
IDialogHostimplementations 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
AvaloniaDispatcherasIDispatcher.
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 | Versions 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. |
-
net10.0
- Avalonia (>= 12.1.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- OutWit.Common.MVVM.Avalonia (>= 3.1.0)
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
-
net8.0
- Avalonia (>= 12.1.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.18)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.18)
- OutWit.Common.MVVM.Avalonia (>= 3.1.0)
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
-
net9.0
- Avalonia (>= 12.1.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.18)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.18)
- OutWit.Common.MVVM.Avalonia (>= 3.1.0)
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
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 |