For the complete documentation index, see llms.txt. This page is also available as Markdown.

MVVM Standards

Purpose

MVVM keeps WPF and MAUI applications testable and maintainable.

Responsibilities

Component
Responsibility

View

Layout, visual states, bindings, controls

ViewModel

Presentation state, commands, UI workflow orchestration

Model / Domain

Business state and rules

Application service

Use case execution

Infrastructure service

External systems, storage, platform APIs

View Rules

  • XAML should not contain business decisions.

  • Code-behind should be limited to UI-specific behaviour.

  • Avoid direct service calls from views.

  • Bind to ViewModel properties and commands.

ViewModel Rules

ViewModels should:

  • be testable without UI runtime

  • expose immutable or observable state

  • use async commands for I/O

  • handle cancellation where practical

  • validate user input

  • expose user-friendly error state

  • not depend directly on WPF controls or MAUI pages

Example ViewModel

MVVM Checklist

  • Can ViewModel be unit tested?

  • Are commands asynchronous where needed?

  • Is UI state explicit?

  • Are errors represented cleanly?

  • Is business logic outside the ViewModel?

  • Are platform-specific dependencies abstracted?

Last updated

Was this helpful?