Logo de Avalonia Pro Max/Layout Patterns

Avalonia Pro Max/Layout Patterns

Comunidade
linuxdevel
avalonia-pro-max/layout-patterns

Use when designing the page-level layout of an Avalonia app — responsive breakpoints, sidebar vs top-nav vs bottom-nav, dashboard grids, master-detail, settings page, mobile vs desktop adaptive layouts. Covers Grid, DockPanel, SplitView, NavigationView, ItemsRepeater layout strategies.

Visão geral

Publicado porlinuxdevel
RepositórioAvalonia-skills
Nome da habilidadeavalonia-pro-max/layout-patterns
Estrelas
50
Forks
4
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Completa em si mesma

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por linuxdevel no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Avalonia Pro Max/Layout Patterns no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-pro-max/layout-patterns
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/linuxdevel/Avalonia-skills.git /tmp/Avalonia-skills
mkdir -p .claude/skills
cp -r /tmp/Avalonia-skills/skills/avalonia/avalonia-pro-max/layout-patterns .claude/skills/linuxdevel-avalonia-pro-max-layout-patterns
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Avalonia Pro Max/Layout Patterns em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Avalonia Pro Max/Layout Patterns automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Avalonia Pro Max/Layout Patterns não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Layout Patterns

Breakpoints

Avalonia desktop windows have no fixed viewport, so define your own breakpoint conventions and react in code-behind or via OnSizeChanged. Recommended scale:

NameWidthTypical
Compact< 640 pxMobile, narrow sidebar collapsed window
Medium640 – 1024 pxTablet, small desktop window
Wide1024 – 1440 pxStandard desktop
XWide≥ 1440 pxLarge desktop, ultrawide
csharp
private void OnSizeChanged(object? sender, SizeChangedEventArgs e)
{
    var classes = (Window)this;
    classes.Classes.Set("compact", e.NewSize.Width <  640);
    classes.Classes.Set("medium",  e.NewSize.Width >= 640  && e.NewSize.Width < 1024);
    classes.Classes.Set("wide",    e.NewSize.Width >= 1024 && e.NewSize.Width < 1440);
    classes.Classes.Set("xwide",   e.NewSize.Width >= 1440);
}

Then style by class:

xml
<Style Selector="Window.compact StackPanel.sidebar"><Setter Property="IsVisible" Value="False"/></Style>

For more granular containers, use ContainerQuery (see avalonia-styling).


Layout Templates

App Shell — Sidebar + Content + Right Panel

xml
<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="240"/>     <!-- Sidebar -->
    <ColumnDefinition Width="*"/>       <!-- Main -->
    <ColumnDefinition Width="320"/>     <!-- Right rail -->
  </Grid.ColumnDefinitions>

  <Border Grid.Column="0" Background="{DynamicResource SurfaceMutedBrush}">
    <!-- nav -->
  </Border>

  <ScrollViewer Grid.Column="1">
    <StackPanel Margin="32" Spacing="{StaticResource Space6}">
      <!-- main content -->
    </StackPanel>
  </ScrollViewer>

  <Border Grid.Column="2" Background="{DynamicResource SurfaceBrush}">
    <!-- detail / inspector -->
  </Border>
</Grid>

Hide the right rail on compact/medium:

xml
<Style Selector="Window.compact Grid > Border:nth-child(3)">
  <Setter Property="IsVisible" Value="False"/>
</Style>

Master-Detail with SplitView

xml
<SplitView IsPaneOpen="True"
           DisplayMode="Inline"
           OpenPaneLength="320">
  <SplitView.Pane>
    <ListBox ItemsSource="{Binding Conversations}"
             SelectedItem="{Binding SelectedConversation}"/>
  </SplitView.Pane>
  <ContentControl Content="{Binding SelectedConversation}"/>
</SplitView>

For mobile-style adaptive: bind DisplayMode to a converter on window width — Inline on wide, Overlay on compact.

Dashboard Grid (Cards)

xml
<ScrollViewer>
  <ItemsControl ItemsSource="{Binding Widgets}" Margin="24">
    <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
        <UniformGrid Columns="3"/>
      </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
      <DataTemplate>
        <Border Classes="card" Margin="8">
          <ContentPresenter Content="{Binding}"/>
        </Border>
      </DataTemplate>
    </ItemsControl.ItemTemplate>
  </ItemsControl>
</ScrollViewer>

For responsive columns, swap to WrapPanel with min card widths:

xml
<WrapPanel Orientation="Horizontal"/>

…and set MinWidth="280" MaxWidth="360" on the card.

For powerful auto-grid behavior, use AvaloniaAutoGrid or custom Layout with ItemsRepeater.

Settings Page

xml
<ScrollViewer>
  <StackPanel MaxWidth="720" Margin="24" Spacing="{StaticResource Space6}">
    <TextBlock Classes="h1" Text="Settings"/>
    <ui:SettingsExpander Header="Account" .../>
    <ui:SettingsExpander Header="Appearance" .../>
    <ui:SettingsExpander Header="Notifications" .../>
    <ui:SettingsExpander Header="Privacy" .../>
  </StackPanel>
</ScrollViewer>

MaxWidth="720" keeps reading length sane on ultrawide.

Centered Single-Column (auth, onboarding)

xml
<ScrollViewer>
  <StackPanel HorizontalAlignment="Center"
              MaxWidth="380"
              Margin="32"
              Spacing="{StaticResource Space4}">
    <Image Source="avares://MyApp/Assets/logo.svg" Height="40"/>
    <TextBlock Classes="h2" Text="Welcome back"/>
    <!-- form -->
  </StackPanel>
</ScrollViewer>

Navigation Pattern Selection

PatternUse whenAvalonia mechanism
Sidebar nav (vertical)Desktop app, ≤8 top-level destinationsSplitView or FluentAvalonia NavigationView PaneDisplayMode="Left"
Top tab nav≤5 destinations, content-focusedTabControl
Bottom navMobile, ≤5 destinationsFluentAvalonia NavigationView PaneDisplayMode="LeftMinimal" (mobile-styled) or custom Grid with RadioButtons
Hamburger drawerMany destinations + secondary navSplitView DisplayMode="Overlay" with toggle
Hamburger drawer, built-in (12.0+)Mobile/adaptive apps without a third-party nav controlDrawerPage (page-based navigation system, see below)
Command palettePower users, search-drivenCustom modal with TextBox + filtered ListBox; bind Ctrl+K
BreadcrumbHierarchical content (file system, settings)Custom ItemsControl with separator template

Never mix sidebar + bottom nav at the same hierarchy level.

Page-based navigation (12.0+)

Avalonia 12.0 adds a built-in page navigation system: Page, ContentPage, DrawerPage, CarouselPage and NavigationPage/TabbedPage (automation peers exist for all three of DrawerPage, NavigationPage, TabbedPage; full docs pages for them were not reachable when verifying, so check the API docs before use). Not available in 11.3 — use SplitView/TabControl/FluentAvalonia there.

DrawerPage (verified API members) wraps Drawer (pane content) and Content, with DrawerBehavior (Auto / Disabled / Flyout / Locked), DrawerLayoutBehavior, DrawerPlacement, DrawerLength, CompactDrawerLength, DisplayMode (SplitViewDisplayMode), DrawerBreakpointLength (size at which it switches to overlay; 0 disables), IsOpen, IsGestureEnabled (swipe), BackdropBrush, plus header/footer/icon slots (DrawerHeader, DrawerFooter, DrawerIcon, their *Templates and *Background/*Foreground):

xml
<DrawerPage DrawerLength="260" DrawerBreakpointLength="800" IsGestureEnabled="True">
  <DrawerPage.Drawer>
    <!-- nav list: same ListBox.nav recipe as the SplitView sidebar -->
  </DrawerPage.Drawer>
  <DrawerPage.Content>
    <ContentControl Content="{Binding CurrentView}"/>
  </DrawerPage.Content>
</DrawerPage>

Guidance: it replaces the hand-rolled "sidebar on desktop, overlay on compact" SplitView logic by using DrawerBreakpointLength instead of code-behind width switches. Page lifecycle events fire after transitions complete.

Adaptive nav (single source of truth)

csharp
NavigationView.PaneDisplayMode = window.Bounds.Width switch
{
    < 640  => NavigationViewPaneDisplayMode.LeftMinimal,
    < 1024 => NavigationViewPaneDisplayMode.LeftCompact,
    _      => NavigationViewPaneDisplayMode.Left
};

Spacing Rhythm in Layouts

  • Page padding: 24–32 px on desktop, 16 px on compact.
  • Section spacing: Space6 (24 px) between major sections, Space4 (16 px) within.
  • Card padding: PaddingCard (20 px).
  • StackPanel.Spacing instead of per-child Margin (cleaner, less drift).

Avoid Margin and Padding collision — pick one.


ScrollViewer Discipline

  • Wrap only the scrollable region, not the whole window — let headers/footers stay fixed.
  • One vertical scroll axis per view; nested scroll regions break wheel/trackpad UX.
  • Set HorizontalScrollBarVisibility="Disabled" on vertical lists to prevent accidental horizontal scroll.
  • For long lists, use a VirtualizingStackPanel (default in ListBox/ItemsRepeater) — never a regular StackPanel for 100+ items.
xml
<ListBox ItemsSource="{Binding Items}">
  <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
      <VirtualizingStackPanel Orientation="Vertical"/>
    </ItemsPanelTemplate>
  </ListBox.ItemsPanel>
</ListBox>

For grid virtualization, use ItemsRepeater with StackLayout or UniformGridLayout.


Window Chrome

11.x:

xml
<Window ExtendClientAreaToDecorationsHint="True"
        ExtendClientAreaTitleBarHeightHint="-1"
        ExtendClientAreaChromeHints="PreferSystemChrome">

Hints ((11.x) only — ExtendClientAreaChromeHints is removed in 12):

  • PreferSystemChrome — keep OS controls (recommended).
  • NoChrome — fully custom (provide your own min/max/close buttons).
  • OSXThickTitleBar — macOS thicker bar with traffic lights inset.

12.0+:

xml
<Window ExtendClientAreaToDecorationsHint="True"
        ExtendClientAreaTitleBarHeightHint="-1"
        WindowDecorations="Full">
  • Window.WindowDecorations (enum WindowDecorations: Full = default, BorderOnly = border without title bar, None) replaces SystemDecorations and ExtendClientAreaChromeHints. SystemDecorations is obsolete in 12.
  • ExtendClientAreaToDecorationsHint stays; on Windows it now works in all scenarios, so remove old maximized-margin workarounds.
  • Themeable client-side decorations (12.0+): WindowDrawnDecorations (namespace Avalonia.Controls.Chrome) is a logical element (derives from Animatable, not Control) that manages app-drawn decorations: Template (IWindowDrawnDecorationsTemplate), HasTitleBar/HasBorder/HasShadow, TitleBarHeight/FrameThickness/ShadowThickness (effective values; theme sets the Default* ones), Title. It is supplied by the theme, not placed in window XAML; it replaces Chrome.TitleBar, CaptionButtons and ChromeOverlayLayer (removed). Restyle it through the theme instead of overlaying your own buttons. Member-level docs: WindowDecorationProperties, IWindowDrawnDecorationsTemplate in the same namespace; read them before writing a custom template.
  • Windows 11 corner rounding (12.1+): attached property Win32Properties.WindowCornerPreference (nested enum Win32Properties.WindowCornerPreference, namespace Avalonia.Controls: Default, DoNotRound, Round, RoundSmall; maps to DWM DWM_WINDOW_CORNER_PREFERENCE). XAML: <Window Win32Properties.WindowCornerPreference="RoundSmall">; code: Win32Properties.SetWindowCornerPreference(window, Win32Properties.WindowCornerPreference.DoNotRound). Works only on Windows 11 (build 22000+), ignored elsewhere.

Reserve 40 px top safe area for the drag region. Add a DragRegion element with IsHitTestVisible="True" and listen for pointer drag if going chromeless.


Mobile-Specific (Avalonia.Mobile)

  • Use SafeAreaPadding from TopLevel.InsetsManager:
    csharp
    var insets = TopLevel.GetTopLevel(this)!.InsetsManager;
    insets.DisplayEdgeToEdge = true;
  • Bottom nav must respect home-indicator inset.
  • Touch targets ≥44×44 dp.
  • One vertical scroll axis only.

Common Mistakes

  • Fixed pixel widths on the whole layout — breaks at small windows. Use * Grid columns.
  • StackPanel for a 500-item list — laggy; use ListBox/ItemsRepeater (virtualized).
  • Two vertical scroll regions stacked — wheel doesn't know which to scroll.
  • No MaxWidth on long-form text — line length exceeds 90 chars and hurts readability.
  • Sidebar always visible at 800px window — content gets cramped; collapse to overlay.
  • Putting nav in a Window and content in a Window separately — single-window app should use SplitView/NavigationView.
  • Hardcoded margins like 12,8,15,4 — break the spacing scale; use tokens.
  • Forgetting RowDefinitions="Auto,*" — content expands wrongly.
  • Mixing DockPanel and Grid semantics in the same panel — confusing layout. Pick one root layout per scope.

Perguntas frequentes

O que a habilidade de IA Avalonia Pro Max/Layout Patterns faz?

Use when designing the page-level layout of an Avalonia app — responsive breakpoints, sidebar vs top-nav vs bottom-nav, dashboard grids, master-detail, settings page, mobile vs desktop adaptive layouts. Covers Grid, DockPanel, SplitView, NavigationView, ItemsRepeater layout strategies.

Por que usar Avalonia Pro Max/Layout Patterns no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Avalonia Pro Max/Layout Patterns é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Avalonia Pro Max/Layout Patterns no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-pro-max/layout-patterns. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Avalonia Pro Max/Layout Patterns?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Avalonia Pro Max/Layout Patterns?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Avalonia Pro Max/Layout Patterns com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Avalonia Pro Max/Layout Patterns é gratuita?

Sim. A habilidade é publicada no GitHub por linuxdevel sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇