MSB.Mvvm
2.0.1
dotnet add package MSB.Mvvm --version 2.0.1
NuGet\Install-Package MSB.Mvvm -Version 2.0.1
<PackageReference Include="MSB.Mvvm" Version="2.0.1" />
<PackageVersion Include="MSB.Mvvm" Version="2.0.1" />
<PackageReference Include="MSB.Mvvm" />
paket add MSB.Mvvm --version 2.0.1
#r "nuget: MSB.Mvvm, 2.0.1"
#:package MSB.Mvvm@2.0.1
#addin nuget:?package=MSB.Mvvm&version=2.0.1
#tool nuget:?package=MSB.Mvvm&version=2.0.1
MSB.Mvvm (NET Standard)
Description
The MVVM Package is a NuGet package that provides a set of classes and utilities for implementing the Model-View-ViewModel architectural pattern in your .NET applications. The MVVM pattern helps separate concerns and provides a clear separation between the user interface (View), business logic (ViewModel), and data (Model).
Features
ViewModelBase
- The
ViewModelBase
class is an abstract base class that implements theINotifyPropertyChanged
interface and provides common functionality for ViewModel classes. It includes methods for raising property change notifications and managing property values.
RelayCommand
- The
RelayCommand
class is an implementation of theICommand
interface that allows binding commands to methods in the ViewModel. It provides a way to encapsulate and execute parameterless commands.
RelayCommand<T>
- The
RelayCommand<T>
class is a generic version of theRelayCommand
class that allows binding commands to methods in the ViewModel with a single parameter of type T.
RelayCommandAsync
- The
RelayCommandAsync
class is an asynchronous version of theRelayCommand
class. It allows binding commands to asynchronous methods in the ViewModel.
RelayCommandAsync<T>
- The
RelayCommandAsync<T>
class is a generic version of theRelayCommandAsync
class that allows binding commands to asynchronous methods in the ViewModel with a single parameter of type T.
Installation
To install the library simply download it from NuGet and add the reference to your project.
Below we give you several options to install it using your preferred package manager.
.NET CLI
> dotnet add package MSB.Mvvm --version 2.X.X
Package Manager
PM> Install-Package MSB.Mvvm -Version 2.X.X
PackageReference
<PackageReference Include="MSB.Mvvm" Version="2.X.X" />
Paket CLI
> paket add MSB.Mvvm --version 2.X.X
Script & Interactive
> #r "nuget: MSB.Mvvm, 2.X.X"
Cake
// Install MSB.Mvvm as a Cake Addin
#addin nuget:?package=MSB.Mvvm&version=2.X.X
// Install MSB.Mvvm as a Cake Tool
#tool nuget:?package=MSB.Mvvm&version=2.X.X
Usage
To use the MVVM Package in your project, follow these steps:
- Install the MVVM Package from NuGet using the command mentioned above.
- Create your ViewModel classes by inheriting from the
ViewModelBase
class. - Implement your commands using the
RelayCommand
orRelayCommandAsync
classes. - Bind your commands to UI elements in your View.
- Enjoy the benefits of the MVVM pattern in your application!
Example
Here's an example of a simple ViewModel that uses the MVVM Package:
using System.Windows.Input;
using MSB.Mvvm.Input;
using MSB.Mvvm;
public class MyViewModel : ViewModelBase
{
public MyViewModel()
{
ShowMessageCommand = new RelayCommand(ShowMessage);
}
public string Message
{
get => _message;
set => SetValue(ref _message, value);
}
public ICommand ShowMessageCommand
{
get;
}
private void ShowMessage()
{
Message = "Hello, MVVM!";
}
private string _message;
}
License
Feel free to modify the content according to your package's features and specifications.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 was computed. 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. |
-
.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.