Benday.Presentation
3.0.0
dotnet add package Benday.Presentation --version 3.0.0
NuGet\Install-Package Benday.Presentation -Version 3.0.0
<PackageReference Include="Benday.Presentation" Version="3.0.0" />
<PackageVersion Include="Benday.Presentation" Version="3.0.0" />
<PackageReference Include="Benday.Presentation" />
paket add Benday.Presentation --version 3.0.0
#r "nuget: Benday.Presentation, 3.0.0"
#:package Benday.Presentation@3.0.0
#addin nuget:?package=Benday.Presentation&version=3.0.0
#tool nuget:?package=Benday.Presentation&version=3.0.0
Benday.Presentation - MAUI MVVM Toolkit
MVVM toolkit for .NET MAUI that reduces boilerplate and simplifies data binding.
Since version 3.0 the view models themselves live in
Benday.Presentation.Core, which has no
MAUI dependency and is shared with the WPF package. This package depends on it and adds the MAUI
pieces: value converters, styles and MessageBoxMessageManager. Namespaces did not change, so
code written against 2.x compiles as it is.
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> - Wrap form fields with built-in support for labels, validation messages, visibility, and enabled state
- SelectableCollectionViewModel<T> - Observable collections with automatic selection tracking (single or multi-select), drag-and-drop reordering via
Move(), and selection interception viaBeforeSetSelectedItem - MessagingViewModelBase - Display message boxes and dialogs from your ViewModels
- ExceptionHandlingRelayCommand / ExceptionHandlingAsyncRelayCommand - Commands that catch and display exceptions automatically
- Value Converters - Common converters for MAUI data binding including
VisibleIfNullValueConverterandVisibleIfNotNullValueConverter
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.
Installing
dotnet add package Benday.Presentation
Quick Start
public class MyViewModel : ViewModelBase
{
public ViewModelField<string> FirstName { get; } = new(string.Empty);
public ViewModelField<string> LastName { get; } = new(string.Empty);
public void Validate()
{
FirstName.IsValid = !string.IsNullOrEmpty(FirstName.Value);
FirstName.ValidationMessage = FirstName.IsValid ? "" : "Required";
}
}
Documentation
Full documentation: https://benday-inc.github.io/mvvm-presentation/
Related Packages
- Benday.Presentation.Core - The view models, with no UI framework (required dependency)
- Benday.Presentation.Wpf - The WPF equivalent of this package and the controls
- Benday.Presentation.Controls - Ready-to-use MAUI controls that bind to ViewModelField objects
| 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-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 is compatible. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows10.0.19041 is compatible. net11.0 is compatible. net11.0-ios27.2 is compatible. net11.0-maccatalyst27.2 is compatible. net11.0-windows10.0.19041 is compatible. |
-
net10.0
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 10.0.110)
-
net10.0-ios26.0
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 10.0.110)
-
net10.0-maccatalyst26.0
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 10.0.110)
-
net10.0-windows10.0.19041
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 10.0.110)
-
net11.0
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 11.0.0)
-
net11.0-ios27.2
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 11.0.0)
-
net11.0-maccatalyst27.2
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 11.0.0)
-
net11.0-windows10.0.19041
- Benday.Presentation.Core (>= 3.0.0)
- Microsoft.Maui.Controls (>= 11.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Benday.Presentation:
| Package | Downloads |
|---|---|
|
Benday.Presentation.Controls
Ready-to-use .NET MAUI controls for MVVM apps including TextboxField, ComboboxField, ListboxField, and LabelField. Bind entire ViewModelField objects for automatic label, validation, and visibility support. Works with Benday.Presentation toolkit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v3.0.0 - .NET 11 support (alongside .NET 10). The view models, interfaces and commands moved to the new Benday.Presentation.Core package, which has no MAUI dependency and is shared with Benday.Presentation.Wpf.
- Namespaces are unchanged and the moved types are type-forwarded, so existing code and existing binaries keep working
- This package now holds only the MAUI pieces: value converters, Styles.xaml and MessageBoxMessageManager
- See the Benday.Presentation.Core release notes for the view model fixes and the new ExceptionHandlingAsyncRelayCommand
v2.1.0 - Enhanced SelectableCollectionViewModel with drag-and-drop support, selection interception, and improved event handling
- OnItemSelected event now includes the selected item via ItemSelectedEventArgs
- Added Move() method and AfterMove event for drag-and-drop reordering
- Added BeforeSetSelectedItem delegate to intercept/cancel selection changes
- Added IgnoreRequestsToSetNullValuesAsSelected property
- Added IndexOf() method
- Added VisibleIfNullValueConverter and VisibleIfNotNullValueConverter
- Added DebuggingTag property to ViewModelBase
- Added FieldTextEditorStyle to Styles.xaml
- Removed Console.WriteLine debug statements
v2.0.0 - .NET 10 support
v1.2.3 - Fixed bug where SelectableCollection was setting the wrong selected item if an item was already selected
v1.2.2 - Fixed bug where SelectableCollection wasn't always subscribing to events on ObservableCollection
v1.2.1 - Fixed stack overflow exception in SelectableCollectionViewModel
v1.2 - Fixed a nasty bug in SelectableCollectionViewModel where the wrong interface was being checked for IsSelected value changes
v1.1 - Multi select list view model
v1.0 - Initial release