avalonia-controls-layout

Document Avalonia layout container APIs and common pitfalls.

27|2|Updated Apr 23, 2026
One-click install
npx skills add https://github.com/linuxdevel/Avalonia-skills --skill avalonia-controls-layout
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: avalonia-controls-layout
Source: https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-controls/layout
Command: npx skills add https://github.com/linuxdevel/Avalonia-skills --skill avalonia-controls-layout

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Layout controls are essential for building responsive Avalonia UIs. This skill consolidates the core container APIs (Border, ScrollViewer, SplitView, Expander, Viewbox, and common panel variants) and documents typical pitfalls to help developers craft reliable, scalable layouts in Avalonia 12.

Core Features & Use Cases

  • Border: a single-child container with background, border, padding, and optional shadows.
  • ScrollViewer: scrollable content with configurable horizontal/vertical scrolling, offsets, extent, viewport, and auto-hide behavior.
  • SplitView: two-region layout with a collapsible pane, configurable display modes, and pane/content properties.
  • Expander: collapsible section with a persistent header and animated expand/collapse.
  • Viewbox: scales its single child to fit available space with configurable Stretch options.
  • Panel Variants: Grid, StackPanel, WrapPanel, DockPanel, UniformGrid, Canvas, and other layout patterns.
  • Quick tips: avoid common pitfalls such as stacking layout controls inside a StackPanel that prevents scrolling, and ensure child elements declare Grid rows/columns where needed.

Quick Start

Create a simple responsive page using a SplitView with a ScrollViewer and a StackPanel of controls.

Frequently Asked Questions about avalonia-controls-layout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build responsive Avalonia UI layouts with Grid and SplitView?

Build responsive Avalonia layouts by combining Grid for row/column structures and SplitView for collapsible two-region panes. Configure display modes and pane properties to adapt content areas across different screen sizes.

Why does my Avalonia ScrollViewer not scroll when inside a StackPanel?

Avalonia ScrollViewer fails to scroll inside a StackPanel because StackPanel measures children with infinite height, preventing the viewport from calculating extent. Avoid stacking layout controls that require bounded constraints inside StackPanels.

What is the difference between Viewbox and Border containers in Avalonia?

Viewbox scales its single child to fit available space using Stretch options, whereas Border renders a single-child container with background, border, padding, and optional shadows. Use Viewbox for proportional scaling and Border for visual framing.

How do I configure Avalonia Expander and Viewbox for collapsible UI sections?

Configure Avalonia Expander with a persistent header for animated expand/collapse sections, and wrap content in Viewbox to scale it to available space. Both containers manage single-child content areas efficiently.

Can I use Avalonia panel variants like WrapPanel and DockPanel for cross-platform interfaces?

Avalonia panel variants include WrapPanel, DockPanel, UniformGrid, and Canvas for cross-platform interfaces. Each panel variant manages child arrangement differently, enabling scalable layout patterns without platform-specific code.

What are common Avalonia layout pitfalls with Grid rows and ScrollViewer offsets?

Common Avalonia layout pitfalls include failing to declare Grid row/column definitions for children and misconfiguring ScrollViewer offsets. Ensure child elements specify attached Grid properties and configure horizontal/vertical scrolling extents properly.