avalonia-viewmodels-zafiro
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAvalonia ViewModels with Zafiro
Avalonia ViewModels 结合 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.
本技能提供了一套在Avalonia应用中创建ViewModels、向导以及管理导航的最佳实践与模式,充分利用ReactiveUI和Zafiro工具包的强大功能。
Core Principles
核心原则
- Functional-Reactive Approach: Use ReactiveUI (,
ReactiveObject, etc.) to handle state and logic.WhenAnyValue - Enhanced Commands: Utilize for better command management, including progress reporting and name/text attributes.
IEnhancedCommand - Wizard Pattern: Implement complex flows using and
SlimWizardfor a declarative and maintainable approach.WizardBuilder - Automatic Section Discovery: Use the attribute to register and discover UI sections automatically.
[Section] - Clean Composition: map ViewModels to Views using and manage dependencies in the
DataTypeViewLocator.CompositionRoot
- 函数式响应式方法:使用ReactiveUI(、
ReactiveObject等)处理状态与逻辑。WhenAnyValue - 增强型命令:利用实现更优的命令管理,包括进度报告和名称/文本属性。
IEnhancedCommand - 向导模式:通过和
SlimWizard实现复杂流程,采用声明式且易于维护的方式。WizardBuilder - 自动区域发现:使用特性自动注册和发现UI区域。
[Section] - 清晰的组合:通过将ViewModels映射到Views,并在
DataTypeViewLocator中管理依赖项。CompositionRoot
Guides
指南
- ViewModels & Commands: Creating robust ViewModels and handling commands.
- Wizards & Flows: Building multi-step wizards with .
SlimWizard - Navigation & Sections: Managing navigation and section-based UIs.
- Composition & Mapping: Best practices for View-ViewModel wiring and DI.
- ViewModels & 命令:创建健壮的ViewModels并处理命令。
- 向导与流程:使用构建多步骤向导。
SlimWizard - 导航与区域:管理导航和基于区域的UI。
- 组合与映射:View-ViewModel关联与依赖注入的最佳实践。
Example Reference
示例参考
For real-world implementations, refer to the Angor project:
- : Excellent example of complex Wizard building.
CreateProjectFlowV2.cs - : Simple section ViewModel using functional-reactive commands.
HomeViewModel.cs
如需真实场景的实现示例,请参考Angor项目:
- :复杂向导构建的优秀示例。
CreateProjectFlowV2.cs - :使用函数式响应式命令的简单区域ViewModel示例。
HomeViewModel.cs