Capoala.MVVM 2019.0.1

.NET Core 2.1 .NET Standard 2.0 .NET Framework 4.7
dotnet add package Capoala.MVVM --version 2019.0.1
NuGet\Install-Package Capoala.MVVM -Version 2019.0.1
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="Capoala.MVVM" Version="2019.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Capoala.MVVM --version 2019.0.1
#r "nuget: Capoala.MVVM, 2019.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Capoala.MVVM as a Cake Addin
#addin nuget:?package=Capoala.MVVM&version=2019.0.1

// Install Capoala.MVVM as a Cake Tool
#tool nuget:?package=Capoala.MVVM&version=2019.0.1


Capoala.MVVMis a minimalist framework for MVVM based applications. This framework provides both IPropertyChanged and ICommand implementations, as well as a simple navigation base.



The CommandRelay implements the ICommand interface and comes in two flavors; CommandRelay and CommandRelay<TExecutionParameter> for passing a parameter to the execute method.

Class ViewModel
using Capoala.MVVM;
using System.Diagnostics;

internal class ViewModel
    public CommandRelay SaveCommand { get; } 
        = new CommandRelay(() => Debug.WriteLine("Saving..."));

    public CommandRelay<string> AddInputCommand { get; } 
        = new CommandRelay<string>(input => Debug.WriteLine(input));
  • NuGet 8000 byte limit



The INotifyPropertyChanges is a custom interface for implementing the INotifyPropertyChanged interface. The INotifyPropertyChanges interface exposes methods for implementing the INotifyPropertyChanged event and is defined - without summaries - as follows:

public interface INotifyPropertyChanges : INotifyPropertyChanged
    void Notify([CallerMemberName] string propertyName = null);

    bool SetAndNotify<T>(
        ref T backingField, 
        T value, 
        EqualityComparer<T> equalityComparer = null, 
        [CallerMemberName] string propertyName = null);


NotifyPropertyChangesBaseSlim is an abstract class that simply implements the INotifyPropertyChanges interface.


NotifyPropertyChangesBase is an abstract class that implements the INotifyPropertyChanges interface and supports the SubscribeToChanges, NotifyOnChange, and CanExecuteDependentOn attributes. These attributes allow a streamlined approach to notifying other properties and re-triggering the NotifyCanExecuteDidChange method on CommandRelay objects.

using Capoala.MVVM;
using System.Windows;

internal class SampleViewModel : NotifyPropertyChangesBase
    private bool _isOperationInProgress = false;
    public bool IsOperationInProgress 
        get => _isOperationInProgress; 
        set => SetAndNotify(ref _isOperationInProgress, value); 

    private string _firstName;
    public string FirstName 
        get => _firstName; 
        set => SetAndNotify(ref _firstName, value); 

    private string _lastName;
    public string LastName 
        get => _lastName; 
        set => SetAndNotify(ref _lastName, value); 

    [SubscribeToChanges(nameof(FirstName), nameof(LastName))]
    public string DisplayName => $"{FirstName} {LastName}";

    [CanExecuteDependentOn(nameof(FirstName), nameof(LastName), nameof(IsOperationInProgress))]
    public CommandRelay CreateCommand { get; }

    public SampleViewModel() => CreateCommand = new CommandRelay(() => 
        // Do Something.

    }, () => !IsOperationInProgress && 
             !string.IsNullOrEmpty(FirstName) && 


NotifyPropertyChangesBaseAutoBackingStore is an abstract class that inherits from NotifyPropertyChangesBase, but includes a "backing store" in the form of a Dictionary<string, object>. This allows us to not have to define private fields and is useful for testing and "notifying" models. Using the above sample, below is how the code would look using the NotifyPropertyChangesBaseAutoBackingStore base class.

using Capoala.MVVM;
using System.Windows;

internal class SampleViewModel : NotifyPropertyChangesBaseAutoBackingStore
    public bool IsOperationInProgress { get => Get<bool>(); set => Set(value); 
    public string FirstName { get => Get<string>(); set => Set(value); 
    public string LastName { get => Get<string>(); set => Set(value); 

    [SubscribeToChanges(nameof(FirstName), nameof(LastName))]
    public string DisplayName => $"{FirstName} {LastName}";

    [CanExecuteDependentOn(nameof(FirstName), nameof(LastName), nameof(IsOperationInProgress))]
    public CommandRelay CreateCommand { get; }

    public SampleViewModel() => CreateCommand = new CommandRelay(() => 
        // Do Something.

    }, () => !IsOperationInProgress && 
             !string.IsNullOrEmpty(FirstName) && 


The SimpleMvvmNavigator<TNavigationItem> class is a simplistic implementation for navigation. This class exposes only an event for subscribing to navigation changes and a method for performing the navigation itself.

internal static class Services
    internal static SimpleMvvmNavigator<INotifyPropertyChanges> Navigator { get; } 
        = new SimpleMvvmNavigator<INotifyPropertyChanges>();

internal class MainViewModel : NotifyPropertyChangesBaseAutoBackingStore
    public INotifyPropertyChanges CurrentViewModel 
        get => Get<INotifyPropertyChanges>(); 
        set => Set(value); 

    public MainViewModel() => 
        Services.Navigator.NavigationDidHappen += (s, e) => 
            CurrentViewModel = e.NavigationItem;

internal class TestViewModel : INotifyPropertyChanges
    public CommandRelay<INotifyPropertyChanges> Navigate { get; } 
        = new CommandRelay<INotifyPropertyChanges>(
            (viewModel) => Services.Navigator.NavigateTo(viewModel));


MvvmNavigatorBase<TNavigationItem> is an abstract class for implementing a more robust, full featured navigation scheme. This class has default support for going both back and forward as well as additional properties to allow for modification on class inheritance.


MvvmNavigator is a default implementation of MvvmNavigatorBase and allows constructor settings for supporting back and forward navigation, which can yield a small performance benefit.

internal static class Services
    internal static MvvmNavigator<INotifyPropertyChanges> Navigator { get; } 
        = new MvvmNavigator<INotifyPropertyChanges>();

    internal static MvvmNavigator<INotifyPropertyChanges> NoForwardNavigator { get; } 
        = new MvvmNavigator<INotifyPropertyChanges>(supportsForwardNavigation: false);

    internal static MvvmNavigator<INotifyPropertyChanges> NoBackNavigator { get; } 
        = new MvvmNavigator<INotifyPropertyChanges>(supportsBackNavigation: false);

    /* NuGet 8000 byte limit */



SubscribeToChanges is an attribute used to allow a property with this attribute to subscribe to value changes of other properties.


NotifyOnChange is an attribute used to allow a property with this attribute to notify other properties when its value changes.


CanExecuteDependentOn is an attribute used to allow a property - of type CommandRelay or CommandRelay<TExecutionParameter> - to subscribe to value changes of other properties. This attribute differs from SubscribeToChanges, as SubscribeToChanges will raise the PropertyChangedEventHandler event of an INotifyPropertyChanged interface, while this attribute will raise the CanExecuteChanged event of an ICommand interface.

Events and Event Arguments

NavigationChangedEventHandler<TNavigationItem> is a delegate for supporting navigation changes.

The NavigationChangedEventArgs<TNavigationItem> class is used with the NavigationChangedEventHandler<TNavigationItem> event handler for navigation support.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • No dependencies.
  • .NETCoreApp 2.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.1

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

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
2019.0.1 587 3/7/2019
2019.0.0-beta.3 270 3/3/2019
2019.0.0-alpha.4 267 3/2/2019
2019.0.0-alpha.3 249 3/1/2019
2019.0.0-alpha.2 249 2/28/2019
2019.0.0-alpha.1 247 2/27/2019
2017.1.2.5 909 11/28/2017
2017.1.1.3 1,234 11/19/2017

Release Notes 2019

API Breaking Changes

This release is incompatible with prior 2017.x releases. Breaking API changes were made due to a combination
of naming conflicts, undesirable - or lack of - functionality, and scalability.

- RelayCommand and RelayCommand<TParameter> have been renamed to CommandRelay and CommandRelay<TExecutionParameter> respectively.
- CommandRelay<TExecutionParameter> no longer supports parameter passing to the CanExecutePredicate function.
- NotifiedOnChange has been renamed to SubscribeToChanges.
- NotifiesOnChange has been renamed to NotifyOnChange.
- A new attribute, CanExecuteDependentOn, now allows for a CommandRelay property to subscribe to property changes that will invoke the CommandRelay's NotifyCanExecuteDidChange() method.
- New INotifyPropertyChanges interface for providing a common object for INotifyPropertyChanged implementations.
- NotifyingObjectBaseSlim has been renamed to NotifyPropertyChangesBaseSlim and implements the INotifyPropertyChanges interface.
- NotifyingObjectBase has been renamed to NotifyPropertyChangesBase and implements the INotifyPropertyChanges interface.
- NotifyPropertyChangesBase supports the NotifyOnChange, SubscribeToChanges, and CanExecuteDependentOn attributes.
- The "auto backing store" functionality has been moved into a new class named NotifyPropertyChangesBaseAutoBackingStore.
- The INavigationService<TNavigationItem> has been dropped.
- The NavigationServiceBase<TNavigationItem> has been revamped and renamed to MvvmNavigatorBase<TNavigationItem>.
- DefaultNavigationService has been renamed to MvvmNavigator<TNavigationItem> and inherits from MvvmNavigatorBase<TNavigationItem>.
- SimpleMvvmNavigator is a simplified implementation of MvvmNavigatorBase, but does not inherit from MvvmNavigatorBase.
- The navigation service implementations now utilize a custom event handler NavigationChangedEventHandler with event argument NavigationChangedEventArgs.