Mvvm.Navigation.Core 1.2.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mvvm.Navigation.Core --version 1.2.6                
NuGet\Install-Package Mvvm.Navigation.Core -Version 1.2.6                
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="Mvvm.Navigation.Core" Version="1.2.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Mvvm.Navigation.Core --version 1.2.6                
#r "nuget: Mvvm.Navigation.Core, 1.2.6"                
#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.
// Install Mvvm.Navigation.Core as a Cake Addin
#addin nuget:?package=Mvvm.Navigation.Core&version=1.2.6

// Install Mvvm.Navigation.Core as a Cake Tool
#tool nuget:?package=Mvvm.Navigation.Core&version=1.2.6                

Mvvm.Navigation

CI/CD License: MIT Discord NuGet NuGet NuGet NuGet NuGet NuGet NuGet NuGet

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container.

🔥Features🔥

  • Uses DI to resolve your view from view model.
  • Generates an extension method for you with all your Views and ViewModels to register them in DI.
  • Does not contain custom controls, everything happens based on the attached dependency property and does not limit the user.
  • Allows forward/backward navigation like in Chrome.
  • Allows you to receive activation/deactivation events - just implement IActivatableViewModel for your ViewModel.
  • Allows you to generate a typed ViewModel property via an attribute, bound to your BindingContext and initialized from DI.
  • Supports automatic mapping between View and ViewModel based on a global attribute.
  • Allows case-by-case, attribute-based control for Views.

Usage

  1. Add .AddMvvmNavigation() call to your Host builder or IServiceCollection:
public sealed partial class App
{
    public App()
    {
        AppHost = Host
            .CreateDefaultBuilder()
            .AddMvvmNavigation()
            .Build();
    }
}
  1. Add ViewFor attribute to your views:
using Mvvm.Navigation;

[ViewFor<MainViewModel>]
public partial class MainPage : UserControl;

or assembly level attribute(nameof behavior is ignored and the full namespace is taken):

[assembly:MapViews(
    viewsNamespace: nameof(MyNamespace.Views),
    viewModelsNamespace: nameof(MyNamespace.ViewModels))]
  1. Add Navigator to your ViewModel:
public Navigator<ObservableObject> Navigator { get; }
  1. Add commands to your views(or just use Navigator from ViewModel):
<Grid>
    <Button
        Command="{Binding Navigator.NavigateByTypeCommand}"
        CommandParameter="{x:Type viewModels:BlueViewModel}"
        />
    <ContentControl mvvm:Properties.Navigator="{Binding Navigator}"/>
</Grid>

Tip: you can use CommandParameter="{mvvm:Type Type=viewModels:BlueViewModel}" for WinUI/UWP/Uno platforms.

Base

The library was written as a replacement for ReactiveUI in a real project, and inherits some concepts from it, excluding reactivity.
If you have the same task, then the changes are as follows:

  • Replace RoutingState with Navigator
  • Replace IScreen with INavigable
  • Replace ReactiveUserControl with UserControl
  • Replace ReactiveWindow with Window
  • Replace RoutedViewHost and ViewModelViewHost with ContentControl
  • Use mvvm:Properties.ViewModel and mvvm:Properties.Resolver/mvvm:Properties.Navigator(includes resolver) attached dependency properties.

Support

Priority place for bugs: https://github.com/HavenDV/Mvvm.Navigation/issues
Priority place for ideas and general questions: https://github.com/HavenDV/Mvvm.Navigation/discussions
I also have a Discord support channel:
https://discord.gg/g8u2t9dKgE

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Mvvm.Navigation.Core:

Package Downloads
Mvvm.Navigation.Maui

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container ⭐ Last 10 features: - feat: Updated packages. 2024-03-04 - feat: Moved View resolving to Navigator. 2024-03-04 - feat: Changed default DI scopes. 2024-03-04 - feat: Enable Trimming warnings. 2024-03-04 - feat: Replaced Resolver with ServiceProvider extension. 2023-12-03 - feat: Released 1.3.0. 2023-12-01 - feat(apps): Updated Uno app. 2023-11-30 - feat: Updated to net8.0. 2023-11-08 - feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14 - feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14 🐞 Last 10 bug fixes: - fix: Disabled HostBuilderExtensions generation if detected framework is none. 2024-03-05 - fix: Added TryDetectFramework instead DetectFramework. 2024-03-04 - fix: Renamed mvvm:Properties to mvvm:Navigation. 2024-03-04 - fix: Fixed some warnings. 2023-12-18 - fix: Fixed problems with Uno.WinUI. 2023-12-04 - fix: Added GenerateLibraryLayout. 2023-12-04 - fix: Try to use latest DependencyPropertyGenerator. 2023-12-04 - fix: Fixed broken DependencyPropertyGenerator version. 2023-12-04 - fix: Fixed problems with Avalonia. 2023-12-04 - fix: Properties now is static class. 2023-12-04

Mvvm.Navigation.Uwp

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container ⭐ Last 10 features: - feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14 - feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14 - feat: Implemented assembly:MapViews attribute. 2023-09-05 - feat: Added Activation support. 2023-09-04 - feat: Added separate property for InitializeComponent constructor. 2023-09-03 - feat: Released 0.2.0. 2023-09-03 - feat: Added Type markup extension. 2023-09-03 - feat: Added Properties.ViewModelType. 2023-09-02 - feat: Added HostApplicationBuilderExtensions. 2023-09-02 - feat: Removed Ioc.Default from main code. 2023-09-02 🐞 Last 10 bug fixes: - fix: Fixed work of ServiceLifetime.None. 2023-09-22 - fix: Fixed ViewLifetime/ViewModelLifetime. 2023-09-22 - fix: Fixed ViewModel/ViewModelType default binding mode. 2023-09-22 - fix: Removed views with ViewFor attribute from MapViews generation. Closes #6. 2023-09-17 - fix: Fixed issue with combined MapViews and ViewFor. 2023-09-16 - fix: Added try to resolve IResolver from Ioc.Default. 2023-09-15 - fix: Fixed ambiguities with resolver. 2023-09-14 - fix: Generated ViewModel property can be null now. 2023-09-12 - fix: Fixed problems with DependencyPropertyGenerator. 2023-09-11 - fix: Fixed "An expression is too long or complex to compile" in big projects. 2023-09-07

Mvvm.Navigation.Uno.WinUI

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container ⭐ Last 10 features: - feat: Updated packages. 2024-03-04 - feat: Moved View resolving to Navigator. 2024-03-04 - feat: Changed default DI scopes. 2024-03-04 - feat: Enable Trimming warnings. 2024-03-04 - feat: Replaced Resolver with ServiceProvider extension. 2023-12-03 - feat: Released 1.3.0. 2023-12-01 - feat(apps): Updated Uno app. 2023-11-30 - feat: Updated to net8.0. 2023-11-08 - feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14 - feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14 🐞 Last 10 bug fixes: - fix: Disabled HostBuilderExtensions generation if detected framework is none. 2024-03-05 - fix: Added TryDetectFramework instead DetectFramework. 2024-03-04 - fix: Renamed mvvm:Properties to mvvm:Navigation. 2024-03-04 - fix: Fixed some warnings. 2023-12-18 - fix: Fixed problems with Uno.WinUI. 2023-12-04 - fix: Added GenerateLibraryLayout. 2023-12-04 - fix: Try to use latest DependencyPropertyGenerator. 2023-12-04 - fix: Fixed broken DependencyPropertyGenerator version. 2023-12-04 - fix: Fixed problems with Avalonia. 2023-12-04 - fix: Properties now is static class. 2023-12-04

Mvvm.Navigation.WinUI

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container ⭐ Last 10 features: - feat: Updated packages. 2024-03-04 - feat: Moved View resolving to Navigator. 2024-03-04 - feat: Changed default DI scopes. 2024-03-04 - feat: Enable Trimming warnings. 2024-03-04 - feat: Replaced Resolver with ServiceProvider extension. 2023-12-03 - feat: Released 1.3.0. 2023-12-01 - feat(apps): Updated Uno app. 2023-11-30 - feat: Updated to net8.0. 2023-11-08 - feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14 - feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14 🐞 Last 10 bug fixes: - fix: Disabled HostBuilderExtensions generation if detected framework is none. 2024-03-05 - fix: Added TryDetectFramework instead DetectFramework. 2024-03-04 - fix: Renamed mvvm:Properties to mvvm:Navigation. 2024-03-04 - fix: Fixed some warnings. 2023-12-18 - fix: Fixed problems with Uno.WinUI. 2023-12-04 - fix: Added GenerateLibraryLayout. 2023-12-04 - fix: Try to use latest DependencyPropertyGenerator. 2023-12-04 - fix: Fixed broken DependencyPropertyGenerator version. 2023-12-04 - fix: Fixed problems with Avalonia. 2023-12-04 - fix: Properties now is static class. 2023-12-04

Mvvm.Navigation.Avalonia

Provides platform independent navigation at the MVVM level and a Source Generator that automatically binds view and view models and registers this in your DI container ⭐ Last 10 features: - feat: Updated packages. 2024-03-04 - feat: Moved View resolving to Navigator. 2024-03-04 - feat: Changed default DI scopes. 2024-03-04 - feat: Enable Trimming warnings. 2024-03-04 - feat: Replaced Resolver with ServiceProvider extension. 2023-12-03 - feat: Released 1.3.0. 2023-12-01 - feat(apps): Updated Uno app. 2023-11-30 - feat: Updated to net8.0. 2023-11-08 - feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14 - feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14 🐞 Last 10 bug fixes: - fix: Disabled HostBuilderExtensions generation if detected framework is none. 2024-03-05 - fix: Added TryDetectFramework instead DetectFramework. 2024-03-04 - fix: Renamed mvvm:Properties to mvvm:Navigation. 2024-03-04 - fix: Fixed some warnings. 2023-12-18 - fix: Fixed problems with Uno.WinUI. 2023-12-04 - fix: Added GenerateLibraryLayout. 2023-12-04 - fix: Try to use latest DependencyPropertyGenerator. 2023-12-04 - fix: Fixed broken DependencyPropertyGenerator version. 2023-12-04 - fix: Fixed problems with Avalonia. 2023-12-04 - fix: Properties now is static class. 2023-12-04

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.1 864 3/5/2024
1.5.0 144 3/4/2024
1.4.5 602 12/4/2023
1.4.4 229 12/4/2023
1.4.3 181 12/4/2023
1.4.1 166 12/3/2023
1.4.0 164 12/3/2023
1.3.0 170 12/1/2023
1.2.7 456 9/22/2023
1.2.6 255 9/22/2023
1.2.5 279 9/21/2023
1.2.4 283 9/16/2023
1.2.3 269 9/16/2023
1.2.2 276 9/14/2023
1.2.1 321 9/14/2023
1.2.0 285 9/14/2023
1.1.3 292 9/11/2023
1.1.2 298 9/11/2023
1.1.1 268 9/7/2023
1.1.0 295 9/5/2023
1.0.1 278 9/4/2023
1.0.0 289 9/3/2023
0.2.0 312 9/3/2023
0.1.0 323 9/2/2023

⭐ Last 10 features:
- feat: Added BeforeInitializeComponent/AfterInitializeComponent partial methods when generating constructors. Fixed ViewModel init order. 2023-09-14
- feat: Now you can implement IActivatable for window/control and it will work. 2023-09-14
- feat: Implemented assembly:MapViews attribute. 2023-09-05
- feat: Added Activation support. 2023-09-04
- feat: Added separate property for InitializeComponent constructor. 2023-09-03
- feat: Released 0.2.0. 2023-09-03
- feat: Added Type markup extension. 2023-09-03
- feat: Added Properties.ViewModelType. 2023-09-02
- feat: Added HostApplicationBuilderExtensions. 2023-09-02
- feat: Removed Ioc.Default from main code. 2023-09-02

🐞 Last 10 bug fixes:
- fix: Fixed ViewLifetime/ViewModelLifetime. 2023-09-22
- fix: Fixed ViewModel/ViewModelType default binding mode. 2023-09-22
- fix: Removed views with ViewFor attribute from MapViews generation. Closes #6. 2023-09-17
- fix: Fixed issue with combined MapViews and ViewFor. 2023-09-16
- fix: Added try to resolve IResolver from Ioc.Default. 2023-09-15
- fix: Fixed ambiguities with resolver. 2023-09-14
- fix: Generated ViewModel property can be null now. 2023-09-12
- fix: Fixed problems with DependencyPropertyGenerator. 2023-09-11
- fix: Fixed "An expression is too long or complex to compile" in big projects. 2023-09-07
- fix: Fixed "An expression is too long or complex to compile" in big projects. 2023-09-07