MVVM_Utility 1.0.4

dotnet add package MVVM_Utility --version 1.0.4
                    
NuGet\Install-Package MVVM_Utility -Version 1.0.4
                    
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="MVVM_Utility" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVVM_Utility" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="MVVM_Utility" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MVVM_Utility --version 1.0.4
                    
#r "nuget: MVVM_Utility, 1.0.4"
                    
#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.
#:package MVVM_Utility@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MVVM_Utility&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=MVVM_Utility&version=1.0.4
                    
Install as a Cake Tool

Mvvm.TrackableViewModel

Mvvm.TrackableViewModel is a lightweight utility library that simplifies MVVM development by providing deep cloning, edit tracking, and change detection for parent-child view models.

Ideal for WPF, WinForms, and Blazor applications that require editing and rollback support in nested view model hierarchies.


✨ Features

  • ✅ Deep cloning with System.Text.Json or Newtonsoft.Json
  • ✅ Built-in support for IEditableObject (BeginEdit, CancelEdit, EndEdit)
  • ✅ Implements IChangeTracking for automatic change detection
  • ✅ Tracks and propagates change state across nested view models
  • ✅ Seamlessly integrates with UI data binding
  • ✅ Multi-targeting: .NET Framework 4.6.2+, .NET 5–9

📦 Installation

Use the .NET CLI:

dotnet add package Mvvm.TrackableViewModel

Or via NuGet Package Manager:

Install-Package Mvvm.TrackableViewModel

🧪 Example Usage

public class PersonViewModel : ParentBaseViewModel<PersonViewModel>
{
    private string _name;
    public string Name
    {
        get => _name;
        set => UpdateObservable(ref _name, value);
    }

    private int _age;
    public int Age
    {
        get => _age;
        set => UpdateObservable(ref _age, value);
    }

    public PersonViewModel(string name, int age)
    {
        Name = name;
        Age = age;
    }
}

// Usage
var person = new PersonViewModel("Alice", 30);
person.BeginEdit();

person.Name = "Bob"; // This will trigger change tracking

if (person.IsChanged)
{
    person.CancelEdit(); // Reverts changes
    // or
    person.EndEdit(); // Accepts changes and exits edit mode
}

🧠 How it Works

  • BeginEdit() makes a deep clone of the current view model.
  • CancelEdit() reverts all properties back to the cloned state.
  • EndEdit() clears the backup and marks the model as clean.
  • IsChanged gets updated automatically whenever any property changes.
  • Changes in child view models or collections are automatically tracked.

📂 Supported Frameworks

  • .NET 5.0
  • .NET 6.0
  • .NET 7.0
  • .NET 8.0
  • .NET 9.0
  • .NET Framework 4.6.2 and 4.8

🔒 License

© 2025 Abdou Djalilou Ali. All rights reserved.
Licensed under the MIT License.


🙌 Contributing

Feel free to open issues or submit pull requests to improve functionality or documentation!

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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 is compatible.  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 Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

  • .NETFramework 4.8

  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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
1.0.4 189 7/31/2025
1.0.3 159 7/31/2025
1.0.2 173 7/31/2025
1.0.1 173 7/31/2025
1.0.0 175 7/29/2025