Three self-contained demos of the VMx C# package.
Generated architecture diagrams for all examples live in
../DIAGRAMS.md.
Each project carries its own .csproj and currently resolves VMx from the
local source build. After the first NuGet publication, a copied template may
replace that project reference with the VMx package name.
dotnet restoreMinimal console demo. Demonstrates:
- Building a
ComponentVM<UserModel>with the fluent builder. - Subscribing to hub messages (
ConstructionStatusChangedMessageandPropertyChangedMessage). - The full lifecycle: construct → model mutations → destruct → dispose.
- The equality guard: setting the same model value emits no hub message.
Run:
Diagram:
csharp-console-hello-vmx.svg
(HTML,
PNG).
cd console/HelloVMx
dotnet runCross-platform — runs anywhere the .NET SDK runs. The project targets
net8.0, so a host that only has a newer runtime installed (e.g. .NET 9,
no .NET 8) fails at launch with You must install or update .NET … 8.0.0 … was not found. On such a host, roll forward to the installed major:
DOTNET_ROLL_FORWARD=Major dotnet run(The avalonia/NotesShowcase flagship also targets net8.0 and needs the same
roll-forward when only a newer runtime is present.)
Platform: Windows only. WPF is a Windows-only UI framework, so this example only launches on Windows.
dotnet restoreanddotnet buildsucceed cross-platform (the off-WindowsTargetFrameworkdrops the-windowssuffix), butdotnet runrequires Windows.
A todo app that wires VMx into a WPF view. Demonstrates:
TodoItemVMcomposing aComponentVM<TodoItem>(rather than subclassing it) and exposingTitle/Done/ToggleDoneCommandfor the item template — illustrates the composition pattern when you need view-only properties that aren't part of the model.MainWindowViewModelholding anObservableCollection<TodoItemVM>bound to the ListBox plus a VMxRelayCommand(AddCommand) whose task calls the internalAddItem(string); the Add button bindsCommand="{Binding AddCommand}". (The Pythontk/todo_appexample uses aCompositeVM<TodoItemVM>for its collection — both flavors drive the add through a VMxRelayCommand, each idiomatic for its UI toolkit.)MainWindow.xaml— pure view; XAML data binding againstTodoItemVM'sINotifyPropertyChangedsurface (the outer wrapper forwards the innerComponentVM<TodoItem>'s hub-publishedPropertyChangedMessage("Model")to standard INPC forTitle/Done) plus theICommand-exposingToggleDoneCommand.
Run (Windows only):
Diagram:
csharp-wpf-todo-app.svg
(HTML,
PNG).
cd wpf/TodoApp
dotnet rundotnet restore and dotnet build succeed cross-platform; the app only
launches on Windows because of the WPF target.
The Notes Workspace flagship app — a cross-platform XAML editor on
Avalonia 12 + .NET 8 that exercises 19 distinct VMx features in one
cohesive scenario (notebooks tree, paged + filterable notes list, FormVM
editor, capability-aware action bar, notifications, async lifecycle,
dialogs, token-paged global search, edit/preview state, tag autocomplete,
AggregateVM6 root, and the v2.4.0 ThemeVM scenario contract).
Pure-VM contract enforced; every *.axaml.cs code-behind is
limited to the view constructor's AvaloniaXamlLoader.Load(this) call.
Run (macOS / Linux / Windows):
Diagram:
csharp-avalonia-notes-showcase.svg
(HTML,
PNG).
cd ../../ # repo root
dotnet run --project examples/csharp/avalonia/NotesShowcaseSee avalonia/NotesShowcase/README.md
for the project layout, feature-traceability table, and keyboard shortcuts.
Cross-flavor parity is documented in
../notes-showcase-parity.md; the canonical
scenario contract lives at
../../spec/proposals/2026-05-29-notes-showcase-scenario.md.
Open Examples.sln in Visual Studio or Rider to step through the C# example
projects with the debugger attached.
examples/csharp/
├── Examples.sln
├── README.md # this file
├── console/
│ └── HelloVMx/
│ └── HelloVMx.csproj
├── wpf/
│ └── TodoApp/
│ └── WpfTodoApp.csproj
└── avalonia/
├── NotesShowcase/
│ └── NotesShowcase.csproj
└── NotesShowcase.Tests/
└── NotesShowcase.Tests.csproj