Benday.Presentation.Core 3.0.0

dotnet add package Benday.Presentation.Core --version 3.0.0
                    
NuGet\Install-Package Benday.Presentation.Core -Version 3.0.0
                    
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="Benday.Presentation.Core" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Benday.Presentation.Core" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Benday.Presentation.Core" />
                    
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 Benday.Presentation.Core --version 3.0.0
                    
#r "nuget: Benday.Presentation.Core, 3.0.0"
                    
#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 Benday.Presentation.Core@3.0.0
                    
#: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=Benday.Presentation.Core&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Benday.Presentation.Core&version=3.0.0
                    
Install as a Cake Tool

Benday.Presentation.Core - MVVM view models without a UI framework

The view models, interfaces and commands of the Benday.Presentation MVVM toolkit, with no dependency on .NET MAUI or WPF. Reference it from the project that holds your view models and from your unit tests; the UI packages build on it.

NuGet License: MIT

Written by Benjamin Day
Pluralsight Author | Microsoft MVP
https://www.benday.com
https://www.honestcheetah.com
info@benday.com
YouTube: https://www.youtube.com/@_benday

📖 New book: Azure Cosmos DB for .NET Developers: From Document Thinking to Production Patterns — It's the book on Cosmos DB for .NET developers! Document modeling with aggregate roots, hierarchical partition keys, request unit economics, Change Feed patterns, and a complete production case study — all in C# and ASP.NET Core.

Key Features

  • ViewModelField<T> - One object per form field: Value, IsVisible, IsEnabled, IsValid and ValidationMessage
  • SelectableCollectionViewModel<T> - Observable collection that keeps SelectedItem and each item's IsSelected in step (single or multi-select), with Move() for reordering and BeforeSetSelectedItem to veto a selection
  • FilterableListViewModel<T> - A selectable collection with a Filter text property
  • SingleSelectListViewModel / MultiSelectListViewModel - Lists of SelectableItem for drop-downs and list boxes
  • MessagingViewModelBase / IMessageManager - Show messages from a view model without touching the UI, so tests can fake it
  • ExceptionHandlingRelayCommand / ExceptionHandlingAsyncRelayCommand - Commands that catch exceptions and show them through IMessageManager

The namespace is Benday.Presentation.

Installing

dotnet add package Benday.Presentation.Core

You only need to add it yourself in projects with no UI. Benday.Presentation (MAUI) and Benday.Presentation.Wpf bring it in.

Quick Start

using Benday.Presentation;

public class PersonViewModel : MessagingViewModelBase
{
    public PersonViewModel(IMessageManager messages) : base(messages)
    {
        SaveCommand = new ExceptionHandlingAsyncRelayCommand(Messages, SaveAsync);
    }

    public ViewModelField<string> FirstName { get; } = new(string.Empty);
    public ViewModelField<int> Age { get; } = new(0);
    public SingleSelectListViewModel Country { get; } = new(new[]
    {
        new SelectableItem(true, "Canada"),
        new SelectableItem(false, "United States")
    });

    public ExceptionHandlingAsyncRelayCommand SaveCommand { get; }

    private async Task SaveAsync()
    {
        FirstName.IsValid = !string.IsNullOrWhiteSpace(FirstName.Value);
        FirstName.ValidationMessage = FirstName.IsValid ? "" : "First name is required";

        if (FirstName.IsValid)
        {
            await Task.Delay(500); // save somewhere; an exception here is shown to the user
        }
    }
}

Documentation

Full documentation: https://benday-inc.github.io/mvvm-presentation/

Suggestions, Problems, or Bugs?

Got ideas for features you'd like to see? Found a bug? Let us know by submitting an issue https://github.com/benday-inc/mvvm-presentation/issues. Want to contribute? Submit a pull request.

Product 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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Benday.Presentation.Core:

Package Downloads
Benday.Presentation

MVVM toolkit for .NET MAUI: value converters, styles and a Shell-based IMessageManager on top of Benday.Presentation.Core, which supplies ViewModelField for form binding, SelectableCollectionViewModel for lists with selection tracking, and MessagingViewModelBase for ViewModel-driven dialogs. Reduces boilerplate and simplifies data binding in MAUI apps.

Benday.Presentation.Wpf

MVVM toolkit for WPF: TextboxField, TextEditorField, ComboboxField, ListboxField and LabelField controls that bind to a whole ViewModelField or list view model with one binding, plus value converters, styles and a MessageBox-based IMessageManager. Built on Benday.Presentation.Core, the same view models the .NET MAUI packages use.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 0 12/4/2026

v3.0.0 - First release. The view models, interfaces and commands that used to live in Benday.Presentation (which required .NET MAUI) now live here with no UI framework dependency. Targets .NET 10 and .NET 11.
 - SelectableCollectionViewModel unsubscribes from items that are removed, cleared or replaced, and no longer subscribes twice
 - ViewModelField<T>.Value returns null instead of throwing when T is a reference type other than string and no value has been set
 - Added ExceptionHandlingAsyncRelayCommand for async actions
 - ExceptionHandlingRelayCommand takes an optional canExecute function and NotifyCanExecuteChanged() now raises CanExecuteChanged