Routeables.WinUI3 2.1.0

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

Routeables.WinUI3

The WinUI 3 (Windows App SDK) host of Routeables, packaged or unpackaged: the setup call, a routed view base, the region control and a list view for the menu. It is the Windows-only sibling of Routeables.Uno, with the same API (Microsoft.UI.Xaml), and contains no XAML of its own. Targets .NET 10 (net10.0-windows10.0.19041.0).

dotnet add package Routeables.WinUI3

The package brings Routeables (routing, abstractions and the source generator) and Routeables.Native (system notifications): there is nothing else to add.

Set up

public App()
{
    InitializeComponent();
    Services = this.UseRouteables();
}

protected override void OnLaunched(LaunchActivatedEventArgs args) =>
    _window = this.OpenMainWindow(new MainPage());

An application with a menu gives its menu view model: this.UseRouteables<MainViewModel>(r => ...). The window can be opened by the same call, this.UseRouteables(r => ..., () => new MainPage(), window => window.Title = "My app"), when the application already has a dispatcher in its constructor; in a WinUI 3 application it may not, and the call then says so: use OpenMainWindow in OnLaunched, as above. For another window, call window.AttachRouteables().

A view

<routeables:RouteableFor x:Class="MyApp.Views.HelloView"
    xmlns:routeables="using:Routeables.WinUI3" ...>
    <TextBlock Text="{Binding Greeting}" />
</routeables:RouteableFor>
public sealed partial class HelloView : RouteableFor { public HelloView() => InitializeComponent(); }

A XAML root cannot be generic in WinUI, so XAML views use RouteableFor; views written in code can use RouteableFor<TViewModel>. The menu is a RouteableMenuViewModelBase and <routeables:RouteableListView /> (or a NavigationView whose items name a route with routeables:RouteableItem.Route); the page is shown by <routeables:RouteableRegion />.

Bindable view models

Put [System.ComponentModel.Bindable(true)] above every view model a view binds to. It takes the place of the [Bindable] of the platform and lets the XAML compiler generate the binding code, so {Binding} and {x:Bind} do not use reflection at run time (needed for trimming and Native AOT).

// samples/Bases/XAnimals.Common/ViewModels/AnimalsViewModel.cs
[System.ComponentModel.Bindable(true)]
[Routeable("/hello")]
public class HelloViewModel : ViewModelBase { public string Greeting => "Hello"; }

Without it a binding to the view model still works through reflection, which the trimmer may remove.

Dialogs and notifications

In the Routeables.WinUI3.Services namespace, registered by UseRouteables: dialogs, content dialogs and task dialogs as ContentDialogs in the window the user last worked in, toasts as InfoBars at the top of the window, DialogView<TViewModel, TResult> for a modal view written in code.

System notifications (the notification center of Windows) are off until services.WithAppNotifications(); they use AppNotificationManager of the Windows App SDK through Routeables.Native. Windows reports a tap, not a dismissal.

Good to know

  • There is no system Back request on the desktop: a Back button is yours to draw (bind it to IRouter.GoBackAsync).
  • Routeables does not use Frame: do not mix them in one window.
  • Built on Windows only: on another OS the project builds an empty assembly so that a solution still restores.
Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.1.0 209 11/11/2026