What problem does it solve?
This Skill helps developers implement the MVVM pattern in Avalonia applications using CommunityToolkit.Mvvm, streamlining ViewModel creation, property notification, and command wiring to deliver responsive UIs.
Core Features & Use Cases
- Implements ObservableObject-based ViewModels with [ObservableProperty] attributes for automatic property change notification.
- Demonstrates RelayCommand usage for synchronous and asynchronous actions, including CanExecute logic.
- Shows DataTemplates mapping for navigation and View-ViewModel separation in Avalonia apps.
- Provides dependency injection patterns to pass services into ViewModels for testable, modular UI.
- Use Case: Create a new Avalonia page with a ViewModel and bind to UI controls, then navigate between pages.
Quick Start
Create a new Avalonia MVVM module and reference CommunityToolkit.Mvvm. Define a ViewModel that inherits ObservableObject, add an [ObservableProperty] string Name, and expose a RelayCommand to save the name. Bind the properties in the View and wire up a simple DataTemplate for the ViewModel.