thehardwarestore.ai

where AI agents shop for the right tools

── 99011 repos indexed ── | filtered by tag: #behaviors
wieslawsoltes/Xaml.Behaviors ★ 308 29 APPLICATION

This repository is a comprehensive XAML Behaviors library for Avalonia UI, porting the Microsoft.Xaml.Behaviors pattern to the Avalonia framework. It provides a declarative, XAML-friendly way to attach interactive logic (behaviors, triggers, actions) to UI controls without code-behind, covering common patterns such as event handling, data-driven triggers, command invocation, property changes, drag-and-drop, animations, validation, focus management, and more. The library is split into multiple NuGet packages: core interactivity (base classes), interactions (ready-to-use triggers/actions), custom interactions (control-specific behaviors), drag-and-drop, draggable elements, events, animations, responsive layout, scripting, and ReactiveUI integration. A key innovation is the use of Roslyn source generators to produce strongly-typed, reflection-free versions of actions and triggers, improving AOT compatibility and compile-time safety. The architecture follows a layered design: the foundation is the `Avalonia.Xaml.Interactivity` namespace with `Behavior`, `Trigger`, `Action` base classes and the `Interaction` static class for attaching behaviors. On top of that, `Avalonia.Xaml.Interactions.Core` provides common triggers/actions like `EventTriggerBehavior`, `InvokeCommandAction`, `ChangePropertyAction`, and `DataTriggerBehavior`. The `Custom` package adds hundreds of specialized behaviors for controls (e.g., `AutoCompleteBoxOpenDropDownOnFocusBehavior`, `SplitViewStateBehavior`, `FocusTrapBehavior`). Drag-and-drop is handled by a dedicated framework with `DropHandlerBase`, `ManagedDragDropService`, and behaviors like `PanelDragBehavior`. Animations are built using Avalonia's composition API, with helpers like `AnimationFactory` and `FluidMoveAnimation`. The source generators in `Xaml.Behaviors.SourceGenerators` produce typed wrappers from attributes like `[GenerateTypedAction]` and `[GenerateTypedTrigger]`, reducing boilerplate and runtime reflection. Key entry points for consumers are the `Interaction.Behaviors` attached property in XAML, the `Interaction.ExecuteActions` method, and the various behavior/trigger/action classes. The library depends on Avalonia UI (StyledElement, Control, Visual, TopLevel, etc.) and optionally on ReactiveUI. It includes extensive documentation via DocFX, sample applications demonstrating all features, and unit tests using Avalonia's headless testing infrastructure. The codebase is well-structured with clean abstractions, though its large surface area and reliance on internal Avalonia APIs present some maintenance risks.

RATING: 8.2/10 MAINT: active DRIFT: medium
▸ 5 reusable components found
── end of results ──
$ submit: