avalonia-data-binding

Explain Avalonia 12 compiled bindings, converters, and validation patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing data binding in Avalonia apps—especially with compiled bindings, converters, and validation—can be verbose and error-prone without a guided reference. This Skill consolidates core patterns, best practices, and common pitfalls into a single, reusable resource for developers.

Core Features & Use Cases

  • Comprehensive coverage of Avalonia 12 data-binding concepts: compiled vs reflection bindings, DataContext, x:DataType, binding modes, converters, MultiBinding, and data templates.
  • Practical guidance for binding to commands, validations, fallback and target-null values, and debugging techniques with DevTools and trace output.
  • Real-world use cases across MVVM patterns (CommunityToolkit.Mvvm, ReactiveUI) and common UI controls (TextBox, ListBox, DataGrid).

Quick Start

Create a simple Avalonia view with a ViewModel, enable x:DataType on the root, and bind a TextBox.Text property to a string property using a compiled binding.

Frequently Asked Questions about avalonia-data-binding

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

FAQPage Schema
How do I set up compiled bindings in Avalonia 12?

Set up compiled bindings in Avalonia by assigning the x:DataType attribute on your root view and binding properties directly to the ViewModel. This provides compile-time validation and improves performance compared to reflection bindings.

What is the difference between compiled and reflection bindings in Avalonia?

Compiled bindings use x:DataType for compile-time type checking and better performance, whereas reflection bindings resolve paths dynamically at runtime. Compiled bindings are recommended for Avalonia 12 to catch errors early.

How do I debug broken DataContext propagation in Avalonia?

Debug DataContext propagation issues using Avalonia DevTools and trace output to inspect visual trees and binding errors. This technique helps verify that DataContext inheritance reaches the target controls correctly.

How do I use value converters with MultiBinding in Avalonia?

Use value converters with MultiBinding in Avalonia by implementing IValueConverter or IMultiValueConverter to transform multiple source values into a single target property. This Skill provides practical examples for these converter patterns.

Does Avalonia data binding support CommunityToolkit.Mvvm and ReactiveUI?

Avalonia data binding fully supports CommunityToolkit.Mvvm and ReactiveUI across MVVM patterns. You can bind commands and properties directly to common UI controls like TextBox, ListBox, and DataGrid using these frameworks.

How do I configure validation and fallback values in Avalonia bindings?

Configure Avalonia binding validation and fallback values by setting FallbackValue and TargetNullValue properties on your bindings. This ensures controls display default values when binding paths fail or resolve to null.