SingleFinite.Mvvm
0.0.45
dotnet add package SingleFinite.Mvvm --version 0.0.45
NuGet\Install-Package SingleFinite.Mvvm -Version 0.0.45
<PackageReference Include="SingleFinite.Mvvm" Version="0.0.45" />
<PackageVersion Include="SingleFinite.Mvvm" Version="0.0.45" />
<PackageReference Include="SingleFinite.Mvvm" />
paket add SingleFinite.Mvvm --version 0.0.45
#r "nuget: SingleFinite.Mvvm, 0.0.45"
#:package SingleFinite.Mvvm@0.0.45
#addin nuget:?package=SingleFinite.Mvvm&version=0.0.45
#tool nuget:?package=SingleFinite.Mvvm&version=0.0.45
SingleFinite.Mvvm
SingleFinite.Mvvm is a Model-View-ViewModel library. It's built for .NET Core and contains interfaces, classes, and services that provide a solid foundation for building a modern MVVM .NET application.
Getting started
The following example illustrates a simple "hello world" style app that shows how to get something up and running after adding the SingleFinite.Mvvm nuget package as a dependency in your project.
To start, let's define a simple view model class that extends ViewModel:
// MyViewModel.cs
//
using SingleFinite.Mvvm;
namespace MyApp;
public class MyViewModel : ViewModel
{
}
and a corresponding view class that implements IView and will be used with the view model defined above:
// MyView.cs
//
using SingleFinite.Mvvm;
namespace MyApp;
public class MyView(MyViewModel viewModel) : IView<MyViewModel>
{
public MyViewModel ViewModel => viewModel;
}
Now that we have a view model and view defined we can configure an instance of AppHost that will host our application state:
// Program.cs
//
using SingleFinite.Mvvm;
namespace MyApp;
var services = new ServiceCollection();
var appHost = new AppHostBuilder()
.AddViews(views => views.Add<MyViewModel, MyView>())
.Build(services);
var provider = services.BuildServiceProvider();
appHost.Start(provider);
As you can see above we use the AddViews method to register the MyViewModel and MyView types. Now when we want to display an instance
of MyViewModel an instance of MyView will be used to display it.
ℹ️ Note
There is an extension method for registering views that can be used to scan assemblies for
ViewModelandIViewtypes to register but we manually register them here for better clarity in the example.
Let's create a new instance of MyViewModel from the AppHost instance we created above:
// Program.cs
//
// ...
var presenter = provider.GetRequiredService<IItemPresenter>();
var viewModel = presenter.Set<MyViewModel>();
Console.WriteLine($"My ViewModel => {viewModel.GetType().FullName}");
Console.WriteLine($"My View => {presenter.Current.GetType().FullName}");
SingleFinite.MVVM is built on top of the Microsoft Dependency Injection library and the AppHostBuilder is
used to register services for the app. We get a new instance of IItemPresenter from the IServiceProvider which we use to create a new instance of
our view model.
IPresenter services are used to create and manage the lifecycle of view models and their views. Both the view model and view
will be created with a new dependency injection scope and will be injected with services as defined in their constructors. Normally you will use
another platform specific library like SingleFinite.Mvvm.Maui to manage the AppHost instance and
to present views for IPresenter based services.
Learn more
Check out the project Wiki for more detailed documentation on this library.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.8)
- SingleFinite.Essentials (>= 0.0.28)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SingleFinite.Mvvm:
| Package | Downloads |
|---|---|
|
SingleFinite.Mvvm.WinUI
Package Description |
|
|
SingleFinite.Mvvm.Maui
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.45 | 99 | 6/6/2026 |
| 0.0.44 | 95 | 6/5/2026 |
| 0.0.43 | 108 | 5/31/2026 |
| 0.0.42 | 107 | 5/30/2026 |
| 0.0.41 | 108 | 5/4/2026 |
| 0.0.40 | 110 | 4/25/2026 |
| 0.0.39 | 107 | 4/22/2026 |
| 0.0.38 | 105 | 4/3/2026 |
| 0.0.37 | 110 | 3/16/2026 |
| 0.0.36 | 103 | 3/13/2026 |
| 0.0.35 | 101 | 3/12/2026 |
| 0.0.34 | 101 | 3/3/2026 |
| 0.0.33 | 108 | 2/28/2026 |
| 0.0.32 | 108 | 2/14/2026 |
| 0.0.31 | 119 | 1/31/2026 |
| 0.0.30 | 197 | 12/23/2025 |
| 0.0.29 | 192 | 12/21/2025 |
| 0.0.28 | 293 | 12/18/2025 |
| 0.0.27 | 152 | 7/31/2025 |
| 0.0.26 | 217 | 4/3/2025 |