技能 编程开发 Avalonia ViewModel与向导模式

Avalonia ViewModel与向导模式

v20260509
avalonia-viewmodels-zafiro
本技能提供了一套用于在Avalonia应用中构建ViewModel、复杂向导(Wizard)和管理导航流的最佳实践模式。它深度结合了ReactiveUI和Zafiro的强大能力,实现了功能反应式状态管理和结构化的命令处理,确保了MVVM架构的高可维护性和健壮性。
获取技能
50 次下载
概览

Avalonia ViewModels with Zafiro

This skill provides a set of best practices and patterns for creating ViewModels, Wizards, and managing navigation in Avalonia applications, leveraging the power of ReactiveUI and the Zafiro toolkit.

Core Principles

  1. Functional-Reactive Approach: Use ReactiveUI (ReactiveObject, WhenAnyValue, etc.) to handle state and logic.
  2. Enhanced Commands: Utilize IEnhancedCommand for better command management, including progress reporting and name/text attributes.
  3. Wizard Pattern: Implement complex flows using SlimWizard and WizardBuilder for a declarative and maintainable approach.
  4. Automatic Section Discovery: Use the [Section] attribute to register and discover UI sections automatically.
  5. Clean Composition: map ViewModels to Views using DataTypeViewLocator and manage dependencies in the CompositionRoot.

Guides

Example Reference

For real-world implementations, refer to the Angor project:

  • CreateProjectFlowV2.cs: Excellent example of complex Wizard building.
  • HomeViewModel.cs: Simple section ViewModel using functional-reactive commands.

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
信息
Category 编程开发
Name avalonia-viewmodels-zafiro
版本 v20260509
大小 4.92KB
更新时间 2026-05-10
语言