AgentStack
SKILL verified MIT Self-run

Avalonia App Development

skill-linuxdevel-avalonia-skills-avalonia-app-development · by linuxdevel

Use when setting up Avalonia app structure, resource dictionaries, application lifetimes, startup configuration, cross-platform project setup, or App.axaml configuration.

No reviews yet
0 installs
9 views
0.0% view→install

Install

$ agentstack add skill-linuxdevel-avalonia-skills-avalonia-app-development

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Avalonia App Development? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Avalonia App Development

Overview

Avalonia app entry: Program.cs builds and runs an AppBuilder. App.axaml + App.axaml.cs is the root. Platform lifetime determines how the app runs (Desktop vs Single-view for mobile/WASM).

Program.cs

using Avalonia;
using Avalonia.ReactiveUI; // or remove if not using ReactiveUI

class Program
{
    [STAThread]
    public static void Main(string[] args) => BuildAvaloniaApp()
        .StartWithClassicDesktopLifetime(args);

    public static AppBuilder BuildAvaloniaApp()
        => AppBuilder.Configure()
            .UsePlatformDetect()
            .WithInterFont()
            .LogToTrace();
            // .UseReactiveUI() // add if using ReactiveUI
}

App.axaml


    
        
    
    
        
    
    
        
            
                
            
            
        
    

App.axaml.cs

public partial class App : Application
{
    public override void Initialize() => AvaloniaXamlLoader.Load(this);

    public override void OnFrameworkInitializationCompleted()
    {
        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
        {
            desktop.MainWindow = new MainWindow
            {
                DataContext = new MainViewModel()
            };
        }
        else if (ApplicationLifetime is ISingleViewApplicationLifetime singleView)
        {
            singleView.MainView = new MainView
            {
                DataContext = new MainViewModel()
            };
        }
        base.OnFrameworkInitializationCompleted();
    }
}

Application Lifetimes

| Lifetime | Interface | Platforms | |---|---|---| | Classic Desktop | IClassicDesktopStyleApplicationLifetime | Windows, macOS, Linux | | Single View | ISingleViewApplicationLifetime | iOS, Android, WASM | | Lifetime-less | None | Headless testing |

Resource Dictionaries


    #FF5722
    
    8

Include with:

StaticResource vs DynamicResource

| | StaticResource | DynamicResource | |---|---|---| | Resolved | Once at load time | On every access | | Runtime changes | No | Yes | | Theme variants | No | Yes (required) | | Performance | Faster | Slightly slower |

Use DynamicResource for anything theme-variant-aware. Use StaticResource for constants that never change.

Assets


    

Access: avares://MyApp/Assets/logo.png

Cross-Platform Project Structure

MyApp/
  MyApp.csproj           — Desktop (Windows/macOS/Linux)
  Program.cs
  App.axaml + .cs
  Views/
  ViewModels/
  Assets/
MyApp.Mobile/            — Optional: iOS/Android
  MyApp.Mobile.csproj
MyApp.Browser/           — Optional: WASM
  MyApp.Browser.csproj
MyApp.Core/              — Shared ViewModels/Models
  MyApp.Core.csproj

Community Libraries & Tooling

Dependency Injection / Hosting

| Library | NuGet | Purpose | |---|---|---| | Lemon.Hosting.Avaloniaui | Lemon.Hosting.Avaloniaui | .NET Generic Host integration for Avalonia | | Prism.Avalonia | Prism.Avalonia | IoC, modules, regions, navigation | | AvaloniaInside.Shell | GitHub: AvaloniaInside/Shell | Shell navigation + side menu for mobile/desktop |

Hot Reload / Dev Tools

| Tool | NuGet / Repo | Purpose | |---|---|---| | HotAvalonia | HotAvalonia | Hot reload for AXAML without restart | | Live.Avalonia | GitHub: worldbeater/Live.Avalonia | Live reloading for development | | Avant Garde | GitHub: kuiperzone/AvantGarde | Standalone cross-platform XAML previewer | | DevTools for Avalonia | devtools.nlnet.net | Enhanced runtime inspector and debugger |

Localization

| Library | NuGet | Purpose | |---|---|---| | Echoes | GitHub: Voyonic-Systems/Echoes | Simple type-safe translations/i18n |

Misc

  • ShowMeTheXaml.Avalonia — display corresponding XAML at runtime for demos/docs (ShowMeTheXaml.Avalonia)
  • Verify.Avalonia — extends Verify for Avalonia headless UI snapshot testing (Verify.Avalonia)
  • Sortable.Avalonia — animated drag-drop sort behavior attachments (sortable-avalonia)
  • AsyncImageLoader.Avalonia — async image loading from web for Image controls (AsyncImageLoader.Avalonia)

Common Mistakes

  • Using StartWithClassicDesktopLifetime for mobile/WASM (must use ISingleViewApplicationLifetime)
  • AvaloniaXamlLoader.Load(this) missing in Initialize() — styles and resources not loaded
  • Using StaticResource for ThemeVariant-sensitive resources — dark mode won't update
  • Asset path casing mismatch on Linux (Assets/Logo.png vs assets/logo.png)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.