Logo vun Avalonia Xaml

Avalonia Xaml

Communautéit
linuxdevel
avalonia-xaml

Use when writing or reviewing Avalonia XAML markup, .axaml files, XML namespaces, code-behind, markup extensions, runtime XAML loading, or building UI without XAML in code.

Iwwersiicht

Editeurlinuxdevel
RepositoryAvalonia-skills
Skill-Nummavalonia-xaml
Stären
50
Forks
4
Matgeliwwert Fichieren
1
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum linuxdevel op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Avalonia Xaml an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-xaml
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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-xaml .claude/skills/avalonia-xaml
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Avalonia Xaml an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Avalonia Xaml automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Avalonia Xaml net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Avalonia XAML

Overview

Avalonia uses .axaml extension (not .xaml) to avoid Visual Studio WPF tooling conflicts. XAML is optional; full code-only UI is supported. (12.0+) compiled bindings are ON by default (AvaloniaUseCompiledBindingsByDefault=true): {Binding} maps to CompiledBinding, so x:DataType is required wherever bindings are used. In 11.x compiled bindings are opt-in ({CompiledBinding} / x:CompileBindings="True"). Escape hatch: {ReflectionBinding Path} or x:CompileBindings="False".

File Structure

Every .axaml file requires the Avalonia root namespace and language namespace:

xml
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:MyApp.ViewModels"
        x:Class="MyApp.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Title="My App"
        Width="800" Height="450">

    <TextBlock Text="{Binding Greeting}" />

</Window>

Corresponding code-behind:

csharp
// MainWindow.axaml.cs
using Avalonia.Controls;

namespace MyApp;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }
}

XML Namespaces

Namespace Syntax

SyntaxUse caseExample
using:Same solution assemblies (preferred)xmlns:vm="using:MyApp.ViewModels"
clr-namespace:External assemblies (requires ;assembly=)xmlns:ctrl="clr-namespace:MyLib.Controls;assembly=MyLib"
URIFramework namespacesxmlns="https://github.com/avaloniaui"

Common Namespaces

PrefixURI / SyntaxPurpose
(default)https://github.com/avaloniauiAll Avalonia controls
x:http://schemas.microsoft.com/winfx/2006/xamlXAML language features
vm:using:MyApp.ViewModelsViewModel types
conv:using:MyApp.ConvertersConverter classes
sys:using:SystemSystem types (Math, String, etc.)

Markup Extensions

ExtensionPurposeExample
{Binding}Compiled binding in 12.0+ (needs x:DataType); reflection binding in 11.xText="{Binding Name}"
{CompiledBinding}Explicit compile-time checked binding (all versions)Text="{CompiledBinding Name}"
{ReflectionBinding}Runtime reflection binding; opt-out when no x:DataType (12.0+; 11.x: use {Binding})Text="{ReflectionBinding Name}"
{StaticResource}One-time resource lookupFill="{StaticResource AccentBrush}"
{DynamicResource}Live resource lookup (updates on change)Background="{DynamicResource SystemControlBackground}"
{x:Static}Static field/propertyValue="{x:Static sys:Math.PI}"
{x:Type}Type referenceTargetType="{x:Type Button}"
{x:Null}Null literalTag="{x:Null}"
{OnPlatform}Per-platform valueFontSize="{OnPlatform 12, macOS=14}"
{OnFormFactor}Per-form-factor valueWidth="{OnFormFactor 200, Mobile=100}"

x: Attributes

AttributePurposeNotes
x:ClassLinks AXAML to code-behind partial classMust match namespace + class name exactly
x:NameNames control for code-behind accessGenerates a typed field in partial class
x:KeyResource dictionary keyRequired for resources in <ResourceDictionary>
x:DataTypeCompiled binding root typeRequired on root or DataTemplate when using compiled bindings
x:CompileBindingsEnable/disable compiled bindings per scopex:CompileBindings="False" to opt out
ExperimentalAttribute (12.0+)XAML honors [Experimental] on types/members: using them needs the diagnostic suppressed (<NoWarn>)

Code-Behind Pattern

csharp
// MyView.axaml.cs
using Avalonia.Controls;

namespace MyApp.Views;

public partial class MyView : UserControl
{
    public MyView()
    {
        InitializeComponent();
    }

    // Access named controls via generated fields
    private void OnButtonClick(object sender, RoutedEventArgs e)
    {
        // myButton is generated from x:Name="myButton" in AXAML
        myButton.IsEnabled = false;
    }
}
xml
<!-- MyView.axaml -->
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="MyApp.Views.MyView">
    <Button x:Name="myButton"
            Content="Click Me"
            Click="OnButtonClick" />
</UserControl>

Code-Only UI (No XAML)

Preferred for: dynamic control creation, headless testing, generated UIs.

csharp
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;

var window = new Window
{
    Title = "Code Only",
    Width = 400,
    Height = 300,
    Content = new StackPanel
    {
        Spacing = 8,
        Margin = new Thickness(16),
        Children =
        {
            new TextBlock { Text = "Hello, Avalonia!" },
            new Button
            {
                Content = "Click Me",
                HorizontalAlignment = HorizontalAlignment.Left
            }
        }
    }
};

Bindings in code:

csharp
var textBox = new TextBox { DataContext = viewModel };
// (12.0+) explicit types; `new Binding(...)` is a compat alias of ReflectionBinding
textBox.Bind(TextBox.TextProperty, new ReflectionBinding(nameof(MainViewModel.Name)));
textBox.Bind(TextBox.TextProperty, CompiledBinding.Create((MainViewModel vm) => vm.Name)); // (12.0+) AOT/trim safe
// (11.x)
textBox.Bind(TextBox.TextProperty, new Binding("Name"));

Gesture Events (12.0+)

Gesture attached events live directly on InputElement — drop the Gestures. prefix (Gestures is no longer public):

xml
<Border Pinch="OnPinch" ScrollGesture="OnScroll" Tapped="OnTapped" />
<!-- (11.x) <Border Gestures.Pinch="OnPinch" Gestures.ScrollGesture="OnScroll" /> -->

Resource Dictionaries

xml
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceInclude Source="avares://MyApp/Assets/Colors.axaml"/>
        </ResourceDictionary.MergedDictionaries>
        <SolidColorBrush x:Key="BrandBrush" Color="#5B4FCF"/>
    </ResourceDictionary>
</Application.Resources>
xml
<!-- Colors.axaml -->
<ResourceDictionary xmlns="https://github.com/avaloniaui"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Color x:Key="BrandColor">#5B4FCF</Color>
</ResourceDictionary>

Runtime XAML for Previewers and Editors

For runtime-loaded documents, relative includes, existing root instances, diagnostics, and source locations, read references/runtime-xaml.md. It covers Avalonia 12.1 and 11.3; normal application views should keep the compiled InitializeComponent() path.

Common Mistakes

MistakeFix
Using .xaml extensionRename to .axaml
Missing xmlns="https://github.com/avaloniaui"Add as first attribute on root element
clr-namespace: without ;assembly= for external libxmlns:x="clr-namespace:MyLib;assembly=MyLib"
Compiled binding error: "Cannot resolve symbol" / {Binding} fails to compile after moving to 12Add x:DataType="vm:MyViewModel" to root or DataTemplate, or use {ReflectionBinding}
Gestures.Pinch="..." in 12.xPinch="..." (12.0+)
x:Name field not accessible in code-behindEnsure file is .axaml and InitializeComponent() is called
{StaticResource} not found at runtimeResource must be defined before use in document order
{DynamicResource} for performance-sensitive pathsUse {StaticResource} when resource never changes

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Avalonia Xaml?

Use when writing or reviewing Avalonia XAML markup, .axaml files, XML namespaces, code-behind, markup extensions, runtime XAML loading, or building UI without XAML in code.

Firwat Avalonia Xaml op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Avalonia Xaml besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Avalonia Xaml an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-xaml an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Avalonia Xaml benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Avalonia Xaml benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Avalonia Xaml domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Avalonia Xaml gratis?

Jo. De Skill gëtt vum linuxdevel ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇