AsyncNavigation.Wpf 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AsyncNavigation.Wpf --version 1.1.0
                    
NuGet\Install-Package AsyncNavigation.Wpf -Version 1.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="AsyncNavigation.Wpf" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsyncNavigation.Wpf" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AsyncNavigation.Wpf" />
                    
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 AsyncNavigation.Wpf --version 1.1.0
                    
#r "nuget: AsyncNavigation.Wpf, 1.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 AsyncNavigation.Wpf@1.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=AsyncNavigation.Wpf&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AsyncNavigation.Wpf&version=1.1.0
                    
Install as a Cake Tool

πŸš€ AsyncNavigation

δΈ­ζ–‡ζ–‡ζ‘£

A lightweight asynchronous navigation framework based on Microsoft.Extensions.DependencyInjection

Try it online : demo

✨ Features

  • Fully Asynchronous Navigation
    Natively supports async/await, making navigation and asynchronous operations seamless and intuitive.

  • Built-in DialogService
    Provides asynchronous implementation for dialog navigation.

  • Supports Cancellation
    Built-in CancellationToken support allows safe cancellation of navigation at any time.

  • Customizable Navigation Indicators
    Developers can define custom indicators to visualize navigation states such as loading, error, or completed.

  • Multiple Built-in Region Types
    In addition to standard single-page navigation based on ContentControl, also supports ItemsControl and TabControl.

  • Minimal Dependencies
    Depends only on Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0).

  • Framework-Agnostic
    Works with any MVVM framework, giving developers complete freedom of choice.

  • Support Native Aot
    Fully supports Avalonia's Native AOT compilation and trimming, without any additional configuration required.

  • RegionAdapter Extension Mechanism
    Extend and customize navigation behaviors by implementing your own RegionAdapter.

  • Fine-grained Control Options
    Offers rich configuration options to make navigation behavior align precisely with application needs.

  • Lifecycle Management
    Automatically handles view creation, caching, and release β€” effectively preventing memory leaks.

  • Highly Abstract Core Layer
    Core logic is encapsulated within abstractions, minimizing platform-specific code and improving testability.


πŸ“¦ Installation

WPF

dotnet add package AsyncNavigation.Wpf

Avaloniaui

dotnet add package AsyncNavigation.Avaloniaui

⚑ Get started

Region
Set Namespace
 xmlns:an="https://github.com/NeverMorewd/AsyncNavigation"
Set RegionName
 <ContentControl an:RegionManager.RegionName="MainRegion" />
ViewModel

<details> <summary>Code Examples</summary>


public class SampleViewModel : INavigationAware
{
    public event AsyncEventHandler<AsyncEventArgs>? AsyncRequestUnloadEvent;

    public virtual Task InitializeAsync(NavigationContext context)
    {
        return Task.CompletedTask;
    }

    public virtual Task<bool> IsNavigationTargetAsync(NavigationContext context)
    {
        return Task.FromResult(true);
    }

    public virtual async Task OnNavigatedFromAsync(NavigationContext context)
    {
        await Task.Delay(100, context.CancellationToken);
    }

    public virtual async Task OnNavigatedToAsync(NavigationContext context)
    {
        await Task.Delay(100, context.CancellationToken);
    }

    public virtual Task OnUnloadAsync(CancellationToken cancellationToken)
    {
        return Task.CompletedTask;
    }

    protected Task RequestUnloadAsync()
    {
        if (AsyncRequestUnloadEvent == null)
        {
            return Task.CompletedTask;
        }
        return AsyncRequestUnloadEvent!.Invoke(this, AsyncEventArgs.Empty);
    }
}

</details>

Config

  var services = new ServiceCollection();
  services.AddNavigationSupport()
          .RegisterView<AView, AViewModel>("AView")
          .RegisterView<BView, BViewModel>("BView");
          .RegisterNavigation<CView, NavigationAware>("CNavigation");
          .RegisterDialog<CView, DialogAware>("CDialog");
          .RegisterDialogWindow<AWindow, AViewModel>("AWindow");

Execute

<details> <summary>Code Examples</summary>


  private readonly IRegionManager _regionManager;
  private readonly IDialogService _dialogService;

  public MainWindowViewModel(IRegionManager regionManager, IDialogService dialogService)
  {
      _regionManager = regionManager;
      _dialogService = dialogService;
  }

  [ReactiveCommand]
  private async Task AsyncNavigate(string param)
  {
      var result = await _regionManager.RequestNavigateAsync("MainRegion", "AView");
  }

  [ReactiveCommand]
  private void Show(string param)
  {
      _dialogService.ShowView("AView", callback: result => 
      {
          Debug.WriteLine(result.Result);
      });
  }

  [ReactiveCommand]
  private void ShowWindow(string param)
  {
      var result = _dialogService.ShowWindowDialog(param);
  }

  [ReactiveCommand]
  private async Task AsyncShowDialog(string param)
  {
      var result = await _dialogService.ShowViewDialogAsync("AView");
  }

  [ReactiveCommand]
  private async Task GoForward()
  {
      await _regionManager.GoForward("MainRegion");
  }

  [ReactiveCommand]
  private async Task GoBack()
  {
      await _regionManager.GoBack("MainRegion");
  }

</details>

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows 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

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.0.2 144 5/19/2026
2.0.1 136 4/20/2026
2.0.0-beta 139 3/20/2026
1.1.0 470 12/11/2025
1.0.1 227 10/30/2025
1.0.0 214 10/21/2025
0.0.2-beta 190 10/17/2025
0.0.1-beta 212 10/14/2025