Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.
Add this skill
npx mdskills install sickn33/avalonia-layout-zafiroWell-structured Avalonia UI layout guidelines with clear checklist and anti-patterns
1---2name: avalonia-layout-zafiro3description: Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.4allowed-tools: Read, Write, Edit, Glob, Grep5---67# Avalonia Layout with Zafiro.Avalonia89> Master modern, clean, and maintainable Avalonia UI layouts.10> **Focus on semantic containers, shared styles, and minimal XAML.**1112## ๐ฏ Selective Reading Rule1314**Read ONLY files relevant to the layout challenge!**1516---1718## ๐ Content Map1920| File | Description | When to Read |21|------|-------------|--------------|22| `themes.md` | Theme organization and shared styles | Setting up or refining app themes |23| `containers.md` | Semantic containers (`HeaderedContainer`, `EdgePanel`, `Card`) | Structuring views and layouts |24| `icons.md` | Icon usage with `IconExtension` and `IconOptions` | Adding and customizing icons |25| `behaviors.md` | `Xaml.Interaction.Behaviors` and avoiding Converters | Implementing complex interactions |26| `components.md` | Generic components and avoiding nesting | Creating reusable UI elements |2728---2930## ๐ Related Project (Exemplary Implementation)3132For a real-world example, refer to the **Angor** project:33`/mnt/fast/Repos/angor/src/Angor/Avalonia/Angor.Avalonia.sln`3435---3637## โ Checklist for Clean Layouts3839- [ ] **Used semantic containers?** (e.g., `HeaderedContainer` instead of `Border` with manual header)40- [ ] **Avoided redundant properties?** Use shared styles in `axaml` files.41- [ ] **Minimized nesting?** Flatten layouts using `EdgePanel` or generic components.42- [ ] **Icons via extension?** Use `{Icon fa-name}` and `IconOptions` for styling.43- [ ] **Behaviors over code-behind?** Use `Interaction.Behaviors` for UI-logic.44- [ ] **Avoided Converters?** Prefer ViewModel properties or Behaviors unless necessary.4546---4748## โ Anti-Patterns4950**DON'T:**51- Use hardcoded colors or sizes (literals) in views.52- Create deep nesting of `Grid` and `StackPanel`.53- Repeat visual properties across multiple elements (use Styles).54- Use `IValueConverter` for simple logic that belongs in the ViewModel.5556**DO:**57- Use `DynamicResource` for colors and brushes.58- Extract repeated layouts into generic components.59- Leverage `Zafiro.Avalonia` specific panels like `EdgePanel` for common UI patterns.60
Full transparency โ inspect the skill content before installing.