Composable interaction
XAML Behaviors
Add interaction in XAML without turning views into code-behind.
Overview
Reusable actions, triggers, and behaviors for Avalonia, including AOT-friendly generated options, flyout lifecycle events, and resilient state handling.
XAML Behaviors turns routed events and observable state into reusable actions. The library ranges from small interaction primitives to drag-and-drop, viewport, responsive, and strongly typed generated behaviors. Flyout opened and closed events support command binding with the expected logical and data context, triggers attached after a control loads synchronize their lifecycle, and non-convertible DataTrigger values stay inactive instead of interrupting the application.
Actions and triggers
Drag and drop behaviors
Flyout and control lifecycle events
AOT-friendly source generators
Built for
Where it fits.
- Avalonia MVVM applications
- Control authors packaging reusable interaction
- AOT-conscious teams avoiding reflection-heavy wiring
Compatibility & status
Supported
First-class
Integration
Generated options
In the work
Real output,
not a mockup.

Architecture
Clear layers.
Replaceable seams.
XAML / C#
Applications compose reusable behavior through normal Avalonia APIs.
Integration
Focused packages connect to Avalonia properties, input, rendering, and flyout lifecycle events.
Platform
Late-attached triggers synchronize with loaded controls, while invalid DataTrigger conversions remain safely inactive.
Quick start
From package
to first frame.
Choose the package workflow used by your repository, then start from the smallest working example. Replace VERSION with the current stable or prerelease version shown on NuGet.
dotnet add package Xaml.Behaviors<PackageReference Include="Xaml.Behaviors" Version="VERSION" /><PackageVersion Include="Xaml.Behaviors" Version="VERSION" /><Button Content="Save"> <Interaction.Behaviors> <EventTriggerBehavior EventName="Click"> <InvokeCommandAction Command="{Binding SaveCommand}" /> </EventTriggerBehavior> </Interaction.Behaviors></Button>Package surface
Start focused.
Compose as needed.
Source, docs, samples, and releases
The repository is the source of truth.
Use the current documentation and samples, inspect changes, report issues, or support continued open-source maintenance.