Oakrey.ViewModels 3.0.0

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

Oakrey.ViewModels

Oakrey.ViewModels provides small MVVM helpers for WPF applications: base view model classes, relay commands, observable collections, dispatcher-aware events, and hyperlink commands.

Features

  • ViewModelBase implements INotifyPropertyChanged and includes SetProperty helpers for concise property setters.
  • DisposableViewModelBase manages subscriptions through a CompositeDisposable and exposes disposal guards for derived view models.
  • RelayCommand, RelayCommand<T>, and CommandBase support WPF command binding and manual RaiseCanExecuteChanged notifications.
  • LazyCommandFactory creates lazily initialized commands for view models that should defer command allocation.
  • AsyncObservableCollection<T> provides snapshot-based enumeration and dispatcher-aware collection/property change notifications.
  • ObservableQueue<T> raises collection/property notifications and can safely operate without a current WPF Application dispatcher.
  • Hyperlink helpers validate URI schemes before opening links through the shell.

Installation

dotnet add package Oakrey.ViewModels

Package Manager Console:

Install-Package Oakrey.ViewModels

Examples

Use SetProperty in a view model:

public sealed class UserViewModel : ViewModelBase
{
    private string name = string.Empty;

    public string Name
    {
        get => name;
        set => SetProperty(ref name, value);
    }
}

Create a command:

public ICommand SaveCommand { get; } = new RelayCommand(_ => Save(), _ => CanSave);

Use a typed command:

public ICommand OpenCommand { get; } = new RelayCommand<string>(Open, path => !string.IsNullOrWhiteSpace(path));

Create a dispatcher-aware observable queue:

ObservableQueue<string> queue = new();
queue.Enqueue("Ready");

if (queue.TryDequeue(out string? message))
{
    Console.WriteLine(message);
}

Notes

  • RelayCommand<T>.CanExecute(object?) returns false for invalid command parameters; Execute(object?) still throws to surface binding/configuration mistakes.
  • HyperlinkHelper allows http, https, and mailto links by default.
  • ObservableQueue<T> falls back to direct invocation when no WPF application dispatcher is available, which makes it easier to use in tests and non-visual code.

Requirements

  • .NET 10 Windows target (net10.0-windows)
  • WPF enabled project

Project Information

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Oakrey.ViewModels:

Package Downloads
Oakrey.Applications.About

A WPF/.NET library providing an About dialog with application name and version display, loaded assembly/module version listing, RTF EULA rendering, and a Report Issue form with log folder access.

Oakrey.Applications.Terminals

A WPF/MVVM .NET library for building terminal-like interfaces. Provides a generic TerminalViewModel base with reactive message collections (System.Reactive), navigable command history, sort and display settings, file export, and built-in Oakrey.Log and Oakrey.Telemetry integration.

Oakrey.DevOps.UI

Package contains: UI models for managing Azure DevOps work items, including BugModel and FeatureModel. Provides commands for submitting bugs and feature requests with support for attaching logs and tags.

Oakrey.Interactions

The Oakrey.Interactions library provides a framework for managing user interactions in .NET applications. It supports various question and response types, enabling developers to create interactive workflows with ease.

Oakrey.Applications.Abstractions

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 90 7/13/2026
2.1.0 636 2/11/2026
2.0.1 142 1/6/2026
2.0.0 350 11/13/2025
1.3.0 237 10/15/2025
1.2.1 252 9/26/2025
1.2.0 289 6/30/2025
1.1.0 222 6/30/2025
1.0.0 333 4/16/2025