GitHub - thomaslevesque/EssentialMVVM: Minimalist MVVM framework (original) (raw)

NuGet version AppVeyor build AppVeyor tests

A minimalist MVVM framework, which contains the basic building blocks I was tired of rewriting in each of my projects. It doesn't do much, but strives to do it well.

It targets .NET Framework 4.5, .NET Standard 1.3 and .NET Standard 2.0, so it should be usable on most XAML platforms.

Features

BindableBase

A class that implements INotifyPropertyChanged and can be used as a base class for ViewModels. It exposes two methods:

}
public string PropertyThatDependsOnFoo => Foo?.ToUpper();
private DelegateCommand _barCommand;
public ICommand BarCommand => _barCommand ??= new DelegateCommand(Bar);
private void Bar() { }
private void DoSomething() { }
It can also be used in a condition, like this:
private string _foo;
public string Foo
{
get => _foo;
set
{
if (Set(ref _foo, value))
{
// Do something if the value changed
}
}
}

An implementation of ICommand that accepts a delegate to specify what the command does. Exists in multiple flavors:

An asynchronous command will not allow execution (i.e. CanExecute will return false) if the previous execution is incomplete.