OutWit.Common.MVVM.Navigation.WPF
1.0.0
dotnet add package OutWit.Common.MVVM.Navigation.WPF --version 1.0.0
NuGet\Install-Package OutWit.Common.MVVM.Navigation.WPF -Version 1.0.0
<PackageReference Include="OutWit.Common.MVVM.Navigation.WPF" Version="1.0.0" />
<PackageVersion Include="OutWit.Common.MVVM.Navigation.WPF" Version="1.0.0" />
<PackageReference Include="OutWit.Common.MVVM.Navigation.WPF" />
paket add OutWit.Common.MVVM.Navigation.WPF --version 1.0.0
#r "nuget: OutWit.Common.MVVM.Navigation.WPF, 1.0.0"
#:package OutWit.Common.MVVM.Navigation.WPF@1.0.0
#addin nuget:?package=OutWit.Common.MVVM.Navigation.WPF&version=1.0.0
#tool nuget:?package=OutWit.Common.MVVM.Navigation.WPF&version=1.0.0
OutWit.Common.MVVM.Navigation.WPF
The WPF half of OutWit.Common.MVVM.Navigation. It lets a WPF application drop Prism and Unity while staying on WPF — the infrastructure changes, the UI framework does not.
Runnable sample: OutWit.Common.MVVM.Navigation.WPF.Sample, which binds the same view models the Avalonia sample does.
- ViewLocator — the core's
IViewFactoryand aDataTemplateSelector: the view registry first (the only path under trimming/AOT), then a naming convention searched in the view model's own assembly. Created from DI so views may take dependencies. Its templates hold aViewPresenter, so DI-built views work inside anyContentControlorItemsControl. - 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. - ViewPresenter — shows the view of any view model: nested content, zone widgets.
- DialogHostWindow —
IDialogHostover modal windows; dialogs nest; the close button goes through the dialog'sCanCloseAsync. - IApplicationResources — lets a UI module merge its resource dictionaries.
- AddWpfNavigation() — registers all of the above plus
WpfDispatcherasIDispatcher.
Setup
// App.xaml.cs
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var services = new ServiceCollection();
services.AddNavigation(nav =>
{
nav.AddRoute<StudiesViewModel>(Routes.STUDIES);
nav.AddRoute<StudyViewModel>(Routes.STUDY, NavigationRouteMode.Transient);
});
services.AddWpfNavigation(); // or AddWpfNavigation(o => o.UseDialogHost<MyMaterialHost>())
services.AddSingleton<ShellViewModel>();
var provider = services.BuildServiceProvider();
provider.UseWpfViewLocator(); // Application.Resources["OutWit.Navigation.ViewLocator"]
provider.ValidateNavigation(throwOnProblems: Debugger.IsAttached);
MainWindow = new ShellWindow { DataContext = provider.GetRequiredService<ShellViewModel>() };
MainWindow.Show();
_ = provider.GetRequiredService<INavigationService>().NavigateAsync(Routes.STUDIES);
}
<Window xmlns:n="https://schemas.outwit.io/navigation">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /><ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding NavigationBar.Items}" />
<n:NavigationOutlet Grid.Column="1" Outlet="{Binding Main}" />
</Grid>
</Window>
Nested content anywhere: <n:ViewPresenter ViewModel="{Binding Widget}" /> or
<ContentControl Content="{Binding Widget}" ContentTemplateSelector="{StaticResource OutWit.Navigation.ViewLocator}" />.
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
DialogHostWindow wraps a non-Window view in a modal window centred on its owner; define a
Style with key OutWit.Navigation.DialogWindow in the application resources to restyle it.
A view that is a Window is shown as is. For MaterialDesignThemes' DialogHost, implement
IDialogHost and pass it to UseDialogHost<T>().
License
Apache-2.0. Part of the OutWit ecosystem.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net9.0-windows7.0 is compatible. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
- OutWit.Common.MVVM.WPF (>= 2.0.5)
-
net8.0-windows7.0
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
- OutWit.Common.MVVM.WPF (>= 2.0.5)
-
net9.0-windows7.0
- OutWit.Common.MVVM.Navigation (>= 1.0.0)
- OutWit.Common.MVVM.WPF (>= 2.0.5)
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 |
|---|---|---|
| 1.0.0 | 83 | 8/23/2026 |