avalonia-custom-controls

Design reusable Avalonia custom controls with styling boundaries and property systems.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides patterns and guidance for designing reusable Avalonia custom controls across applications and libraries, covering UserControl composition, templated controls, and low-level custom drawing.

Core Features & Use Cases

  • Guidance on choosing between UserControl, TemplatedControl, and Control based on reuse goals.
  • Patterns for StyledProperty vs DirectProperty, and when to use each.
  • How to implement AttachedProperty and use in XAML.
  • Rendering and custom drawing with Render overrides.
  • Creating a reusable control library project with embedded themes and distribution strategies.
  • Common pitfalls and best practices.

Quick Start

Create a reusable Avalonia control library with a templated control and themed template.

Frequently Asked Questions about avalonia-custom-controls

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

FAQPage Schema
How do I choose between UserControl and TemplatedControl when building Avalonia custom controls?

Choose UserControl for simple XAML composition and TemplatedControl when you need clear styling boundaries and template overriding. This Avalonia control design guidance maps reuse goals to the correct base class for your application architecture.

When should I use StyledProperty versus DirectProperty in Avalonia?

Use StyledProperty for standard dependency properties supporting styling and data binding, and DirectProperty for lightweight wrappers around plain C# properties. This pattern ensures correct property ownership and system integration in Avalonia custom controls.

How do I implement and use AttachedProperty in Avalonia XAML?

AttachedProperty allows defining properties on a parent class for use by child elements in XAML. This guidance covers implementing attached properties and applying them to enable flexible layout and behavior configuration across control libraries.

What is the best way to structure a reusable Avalonia control library with themes?

Structure your Avalonia control library by embedding themes directly within the project. This approach provides clear distribution strategies and ensures consumers receive properly themed templated controls without external style dependencies.

How do I override rendering for custom drawing in an Avalonia Control?

Override the Render method within a base Control class to perform low-level custom drawing operations. This technique bypasses standard templating to achieve precise visual rendering for specialized Avalonia UI requirements.

Does this Avalonia control guidance cover common pitfalls in property system implementation?

Yes, this guidance details common pitfalls and best practices regarding property systems, inheritance, and rendering. It helps avoid styling boundary leaks and ensures robust library distribution for reusable Avalonia controls.