MvvmEasy 1.0.1

dotnet add package MvvmEasy --version 1.0.1                
NuGet\Install-Package MvvmEasy -Version 1.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="MvvmEasy" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MvvmEasy --version 1.0.1                
#r "nuget: MvvmEasy, 1.0.1"                
#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 MvvmEasy as a Cake Addin
#addin nuget:?package=MvvmEasy&version=1.0.1

// Install MvvmEasy as a Cake Tool
#tool nuget:?package=MvvmEasy&version=1.0.1                

MVVM Easy

nuget badge nuget downloads badge license badge

An easy MVVM framework to use in your WPF applications.

Usage

Properties

Inherit your ViewModels that are not Dialogs from BaseViewModel to notify binded property changes.

public class MainViewModel : BaseViewModel
{
    private string _test;
    public string Test
    {
        get => _test;
        set
        {
            _test = value;
            OnPropertyChanged();
        }
    }
}

Commands

The DelegateCommand class provide a mechanism to bind Commands and Events from view to viewmodel.

public class MainViewModel : BaseViewModel
{
    public DelegateCommand TestCommand => new DelegateCommand(Test);
    
    private void Test(object parameter)
    {
        //do something...
    }
}

You can also use a method Can to determine when a Command can be executed.

public class MainViewModel : BaseViewModel
{
    public DelegateCommand TestCommand => new DelegateCommand(Test, CanTest);
    
    private void Test(object parameter)
    {
        //do something...
    }
    
    private bool CanTest()
    {
        return true;
    }
}

Dialog Manager

The DialogManager static class allows opening Windows (dialogs) that the corresponding ViewModel inherits from DialogViewModel.

Dialog ViewModel:
public class SampleViewModel : DialogViewModel
{
}
Showing the Dialog:
public class MainViewModel : BaseViewModel
{
    private void ShowExempleDialog()
    {
        bool? dialogResult = DialogManager.ShowDialog(new SampleViewModel());
    }
}

In this case, the ShowDialog method will look for the name of a View that matches the name of the ViewModel by replacing the word "ViewModel" with "View". ViewModel SampleViewModel matches SampleView dialog.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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
1.0.1 373 10/7/2021
1.0.0 266 10/7/2021