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
<PackageReference Include="Benday.Presentation.Core" Version="3.0.0" />
<PackageVersion Include="Benday.Presentation.Core" Version="3.0.0" />
<PackageReference Include="Benday.Presentation.Core" />
paket add Benday.Presentation.Core --version 3.0.0
#r "nuget: Benday.Presentation.Core, 3.0.0"
#:package Benday.Presentation.Core@3.0.0
#addin nuget:?package=Benday.Presentation.Core&version=3.0.0
#tool nuget:?package=Benday.Presentation.Core&version=3.0.0
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.
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,IsValidandValidationMessage - SelectableCollectionViewModel<T> - Observable collection that keeps
SelectedItemand each item'sIsSelectedin step (single or multi-select), withMove()for reordering andBeforeSetSelectedItemto veto a selection - FilterableListViewModel<T> - A selectable collection with a
Filtertext property - SingleSelectListViewModel / MultiSelectListViewModel - Lists of
SelectableItemfor 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.
Related Packages
- Benday.Presentation.Wpf - WPF controls, converters and message boxes for these view models
- Benday.Presentation - .NET MAUI converters, styles and message boxes
- Benday.Presentation.Controls - .NET MAUI controls
| 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. net11.0 is compatible. |
-
net10.0
- CommunityToolkit.Mvvm (>= 8.4.2)
-
net11.0
- CommunityToolkit.Mvvm (>= 8.4.2)
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