# wieslawsoltes/xaml.behaviors architecture

> Architecture diagram of the GitHub repository wieslawsoltes/xaml.behaviors, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wieslawsoltes/xaml.behaviors
- Repository: https://github.com/wieslawsoltes/xaml.behaviors

## Overview

XAML Behaviors is a reusable-interactivity library for Avalonia applications. The principal workflow is that an attached behavior or trigger responds to a UI lifecycle or input event and invokes an action; the interactivity foundation supplies attachment and event-registration support. Other major capabilities include drag-and-drop, standalone animations and their behavior adapters, generated strongly typed triggers/actions, and specialized interaction packages. The excerpts show the behavior/action foundation and parts of drag-and-drop; links for other documented capabilities are limited to README evidence.

Main entry points: [`src/Xaml.Behaviors.Animations/Composition`](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Animations/Composition) (Animation definitions), [`src/Xaml.Behaviors.Interactions.Custom/InputElement/Triggers`](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom/InputElement/Triggers) (Event triggers), [`src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs`](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs) (Managed drag service), [`src/Xaml.Behaviors.Interactivity/StyledElement/StyledElementBehavior.cs`](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/StyledElement/StyledElementBehavior.cs) (Behavior attachment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundation["Interactivity foundation"]
  node_attachment["Behavior attachment"]
  node_actions["Action execution<br/>[Action.cs]"]
  node_eventregistry["Event registration"]
end

subgraph group_interactions["UI interactions"]
  node_triggers["Event triggers<br/>[Triggers]"]
  node_custom["Control behaviors"]
  node_coreactions["Common actions"]
  node_commands["Command behaviors"]
  node_responsive["Adaptive layouts"]
  node_reactiveui["ReactiveUI navigation"]
  node_scripting["Runtime scripting"]
end

subgraph group_dragdrop["Drag and drop"]
  node_dragbehavior["Drag behaviors"]
  node_dragstate[("Drag context")]
  node_manageddrag["Managed drag service"]
  node_dragpreview["Drag preview"]
  node_drophandlers["Drop handlers<br/>[DropHandlerBase.cs]"]
end

subgraph group_animation["Animation"]
  node_animations["Animation definitions<br/>[Composition]"]
  node_animationruntime["Animation runner<br/>[AnimationRunner.cs]"]
  node_animationadapters["Animation behaviors<br/>[Animations]"]
end

subgraph group_extensions["Extensions"]
  node_generators["Source generators"]
end

node_avalonia(("Avalonia UI"))

node_avalonia -->|"hosts behaviors"| node_attachment
node_attachment -.->|"supports invocation"| node_actions
node_eventregistry -.->|"registers events"| node_triggers
node_avalonia -.->|"raises events"| node_triggers
node_triggers -.->|"invokes actions"| node_actions
node_avalonia -->|"hosts behaviors"| node_custom
node_avalonia -->|"hosts actions"| node_coreactions
node_avalonia -->|"hosts behaviors"| node_commands
node_avalonia -->|"hosts behaviors"| node_responsive
node_avalonia -->|"hosts navigation"| node_reactiveui
node_avalonia -->|"hosts scripts"| node_scripting
node_dragbehavior -->|"stores payload"| node_dragstate
node_manageddrag -->|"stores payload"| node_dragstate
node_manageddrag -.->|"updates preview"| node_dragpreview
node_avalonia -->|"enables drag-drop"| node_dragbehavior
node_avalonia -->|"accepts drops"| node_drophandlers
node_avalonia -->|"renders animations"| node_animations
node_animations -.->|"runs definitions"| node_animationruntime
node_animations -->|"adapts animations"| node_animationadapters
node_avalonia -->|"generates behaviors"| node_generators

click node_attachment "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/StyledElement/StyledElementBehavior.cs"
click node_actions "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/AvaloniaObject/Action.cs"
click node_eventregistry "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/Events/AddEventHandlerRegistry.cs"
click node_triggers "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom/InputElement/Triggers"
click node_custom "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom"
click node_coreactions "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions"
click node_commands "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.Custom/ExecuteCommand/Core/ExecuteCommandBehaviorBase.cs"
click node_responsive "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Responsive"
click node_reactiveui "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.ReactiveUI"
click node_scripting "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Scripting"
click node_dragbehavior "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ContextDragBehaviorBase.cs"
click node_dragstate "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/DragDropContextStore.cs"
click node_manageddrag "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs"
click node_dragpreview "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/DragPreviewService.cs"
click node_drophandlers "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/DropHandlerBase.cs"
click node_animations "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Animations/Composition"
click node_animationruntime "https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Animations/Animations/AnimationRunner.cs"
click node_animationadapters "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom/Animations"
click node_generators "https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.SourceGenerators"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_attachment,node_actions,node_eventregistry,node_avalonia toneBlue
class node_triggers,node_custom,node_coreactions,node_commands,node_responsive,node_reactiveui,node_scripting toneAmber
class node_dragbehavior,node_dragstate,node_manageddrag,node_dragpreview,node_drophandlers toneMint
class node_animations,node_animationruntime,node_animationadapters toneRose
class node_generators toneIndigo
```

## Components

### Interactivity foundation

- [Behavior attachment](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/StyledElement/StyledElementBehavior.cs): `src/Xaml.Behaviors.Interactivity/StyledElement/StyledElementBehavior.cs`
- [Action execution](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/AvaloniaObject/Action.cs): `src/Xaml.Behaviors.Interactivity/AvaloniaObject/Action.cs`
- [Event registration](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactivity/Events/AddEventHandlerRegistry.cs): `src/Xaml.Behaviors.Interactivity/Events/AddEventHandlerRegistry.cs`

### UI interactions

- [Event triggers](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom/InputElement/Triggers): `src/Xaml.Behaviors.Interactions.Custom/InputElement/Triggers`
- [Control behaviors](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom): `src/Xaml.Behaviors.Interactions.Custom`
- [Common actions](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions): `src/Xaml.Behaviors.Interactions`
- [Command behaviors](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.Custom/ExecuteCommand/Core/ExecuteCommandBehaviorBase.cs): `src/Xaml.Behaviors.Interactions.Custom/ExecuteCommand/Core/ExecuteCommandBehaviorBase.cs`
- [Adaptive layouts](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Responsive): `src/Xaml.Behaviors.Interactions.Responsive`
- [ReactiveUI navigation](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.ReactiveUI): `src/Xaml.Behaviors.Interactions.ReactiveUI`
- [Runtime scripting](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Scripting): `src/Xaml.Behaviors.Interactions.Scripting`

### Drag and drop

- [Drag behaviors](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ContextDragBehaviorBase.cs): `src/Xaml.Behaviors.Interactions.DragAndDrop/ContextDragBehaviorBase.cs`
- [Drag context](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/DragDropContextStore.cs): `src/Xaml.Behaviors.Interactions.DragAndDrop/DragDropContextStore.cs`
- [Managed drag service](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs): `src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs`
- [Drag preview](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/DragPreviewService.cs): `src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/DragPreviewService.cs`
- [Drop handlers](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Interactions.DragAndDrop/DropHandlerBase.cs): `src/Xaml.Behaviors.Interactions.DragAndDrop/DropHandlerBase.cs`

### Animation

- [Animation definitions](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Animations/Composition): `src/Xaml.Behaviors.Animations/Composition`
- [Animation runner](https://github.com/wieslawsoltes/xaml.behaviors/blob/master/src/Xaml.Behaviors.Animations/Animations/AnimationRunner.cs): `src/Xaml.Behaviors.Animations/Animations/AnimationRunner.cs`
- [Animation behaviors](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.Interactions.Custom/Animations): `src/Xaml.Behaviors.Interactions.Custom/Animations`

### Extensions

- [Source generators](https://github.com/wieslawsoltes/xaml.behaviors/tree/master/src/Xaml.Behaviors.SourceGenerators): `src/Xaml.Behaviors.SourceGenerators`

### Other components

- **Avalonia UI**

## Connections

- Avalonia UI → Behavior attachment: hosts behaviors (evidence: `README.md`)
- Behavior attachment → Action execution: supports invocation
- Event registration → Event triggers: registers events
- Avalonia UI → Event triggers: raises events
- Event triggers → Action execution: invokes actions (evidence: `README.md`)
- Avalonia UI → Control behaviors: hosts behaviors (evidence: `README.md`)
- Avalonia UI → Common actions: hosts actions (evidence: `README.md`)
- Avalonia UI → Command behaviors: hosts behaviors (evidence: `README.md`)
- Avalonia UI → Adaptive layouts: hosts behaviors (evidence: `README.md`)
- Avalonia UI → ReactiveUI navigation: hosts navigation (evidence: `README.md`)
- Avalonia UI → Runtime scripting: hosts scripts (evidence: `README.md`)
- Drag behaviors → Drag context: stores payload (evidence: `src/Xaml.Behaviors.Interactions.DragAndDrop/ContextDragBehaviorBase.cs`)
- Managed drag service → Drag context: stores payload (evidence: `src/Xaml.Behaviors.Interactions.DragAndDrop/ManagedDragDrop/ManagedDragDropService.cs`)
- Managed drag service → Drag preview: updates preview
- Avalonia UI → Drag behaviors: enables drag-drop (evidence: `README.md`)
- Avalonia UI → Drop handlers: accepts drops (evidence: `README.md`)
- Avalonia UI → Animation definitions: renders animations (evidence: `README.md`)
- Animation definitions → Animation runner: runs definitions
- Animation definitions → Animation behaviors: adapts animations (evidence: `README.md`)
- Avalonia UI → Source generators: generates behaviors (evidence: `README.md`)
