跳到正文
Skillpedia
界面(UI/UX)48k · #3846

avalonia-layout-zafiro

它能做什么

本指南教你如何为 Avalonia 应用创建美观且易于维护的用户界面。重点在于使用智能组件和共享样式,避免重复代码,简化代码结构。

适用场景

  • ✓开始一个新的 Avalonia 项目,并希望有良好结构时。
  • ✓需要整理或优化应用视觉样式时。
  • ✓页面布局难以组织时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/avalonia-layout-zafiro/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/avalonia-layout-zafiro/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我该如何整理 Avalonia 应用中的视觉样式,让它们便于复用?”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会阅读关于如何在 Avalonia 中组织布局的说明,重点关注使用现成组件和共享样式。它会避免代码重复,并建议页面的最佳结构方式。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Avalonia Layout with Zafiro.Avalonia

Master modern, clean, and maintainable Avalonia UI layouts. Focus on semantic containers, shared styles, and minimal XAML.

🎯 Selective Reading Rule

Read ONLY files relevant to the layout challenge!


📑 Content Map

File Description When to Read
themes.md Theme organization and shared styles Setting up or refining app themes
containers.md Semantic containers (HeaderedContainer, EdgePanel, Card) Structuring views and layouts
icons.md Icon usage with IconExtension and IconOptions Adding and customizing icons
behaviors.md Xaml.Interaction.Behaviors and avoiding Converters Implementing complex interactions
components.md Generic components and avoiding nesting Creating reusable UI elements

🔗 Related Project (Exemplary Implementation)

For a real-world example, refer to the Angor project: /mnt/fast/Repos/angor/src/Angor/Avalonia/Angor.Avalonia.sln


✅ Checklist for Clean Layouts

  • Used semantic containers? (e.g., HeaderedContainer instead of Border with manual header)
  • Avoided redundant properties? Use shared styles in axaml files.
  • Minimized nesting? Flatten layouts using EdgePanel or generic components.
  • Icons via extension? Use {Icon fa-name} and IconOptions for styling.
  • Behaviors over code-behind? Use Interaction.Behaviors for UI-logic.
  • Avoided Converters? Prefer ViewModel properties or Behaviors unless necessary.

❌ Anti-Patterns

DON'T:

  • Use hardcoded colors or sizes (literals) in views.
  • Create deep nesting of Grid and StackPanel.
  • Repeat visual properties across multiple elements (use Styles).
  • Use IValueConverter for simple logic that belongs in the ViewModel.

DO:

  • Use DynamicResource for colors and brushes.
  • Extract repeated layouts into generic components.
  • Leverage Zafiro.Avalonia specific panels like EdgePanel for common UI patterns.

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.
常见问题

什么是“语义化容器”?

这些是功能明确的界面构建模块,例如页眉或侧边栏。你可以直接使用它们,而不必用通用元素再手动逐一配置。

为什么要避免“冗余属性”?

在多个地方重复设置同样的视觉参数(如颜色、尺寸)会让代码变得臃肿,也更难修改。使用共享样式可以解决这个问题。

什么是“反模式”?

指那些看似可行、但日后会带来问题的常见做法,比如难以维护或性能下降。本指南会告诉你应该避免哪些做法。

详情

作者的原始描述

Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3846
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能