avalonia-property-system

Implement Avalonia StyledProperty, DirectProperty, and AttachedProperty declarations with metadata overrides.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Working with Avalonia's property system can be verbose and error-prone, especially when employing StyledProperty, DirectProperty, and AttachedProperty across complex controls and hierarchies.

Core Features & Use Cases

  • Property types: StyledProperty, DirectProperty, and AttachedProperty with practical examples for common controls.
  • Property lifecycle: Inheritance, metadata overrides, coercion, and value priority handling.
  • Observability: Reacting to OnPropertyChanged and GetObservable to drive reactive UI updates.
  • Use Case: Build a custom control that combines StyledProperty styling/animation with a supporting AttachedProperty for child layout configuration.

Quick Start

Create a simple control that defines a StyledProperty, a DirectProperty, and an AttachedProperty and demonstrate inheritance and coercion.

Frequently Asked Questions about avalonia-property-system

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

FAQPage Schema
How do I implement StyledProperty and DirectProperty in Avalonia custom controls?

To implement StyledProperty and DirectProperty in Avalonia, declare them within your custom control class using the appropriate registration methods. StyledProperty supports styling and animation, while DirectProperty wraps existing CLR properties for lightweight data binding.

What is the difference between StyledProperty, DirectProperty, and AttachedProperty in Avalonia?

StyledProperty supports styling, animation, and inheritance in Avalonia controls. DirectProperty wraps existing CLR properties for efficiency, while AttachedProperty allows parent controls to attach property values to child elements, commonly used for layout configuration.

How do I observe Avalonia property changes using OnPropertyChanged and GetObservable?

Observe Avalonia property changes by overriding OnPropertyChanged to handle static change callbacks, or use GetObservable to subscribe to reactive property value streams. Both methods drive reactive UI updates when property values transition.

How do Avalonia property inheritance, metadata overrides, and value coercion work?

Avalonia property inheritance propagates values down the visual tree, metadata overrides customize default behaviors in derived controls, and value coercion intercepts property assignments to enforce constraints and manage value priority.

Can I combine AttachedProperty with StyledProperty for child layout configuration in Avalonia?

Yes, you can define a StyledProperty on a parent control for styling and animation, then use an AttachedProperty to configure child layout behavior. This combination allows complex UI component architecture across control hierarchies.