MvvmEasy 1.0.1
dotnet add package MvvmEasy --version 1.0.1
NuGet\Install-Package MvvmEasy -Version 1.0.1
<PackageReference Include="MvvmEasy" Version="1.0.1" />
paket add MvvmEasy --version 1.0.1
#r "nuget: MvvmEasy, 1.0.1"
// 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
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 | Versions 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. |
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.