Atc.XamlToolkit
1.5.75
dotnet add package Atc.XamlToolkit --version 1.5.75
NuGet\Install-Package Atc.XamlToolkit -Version 1.5.75
<PackageReference Include="Atc.XamlToolkit" Version="1.5.75" />
<PackageVersion Include="Atc.XamlToolkit" Version="1.5.75" />
<PackageReference Include="Atc.XamlToolkit" />
paket add Atc.XamlToolkit --version 1.5.75
#r "nuget: Atc.XamlToolkit, 1.5.75"
#:package Atc.XamlToolkit@1.5.75
#addin nuget:?package=Atc.XamlToolkit&version=1.5.75
#tool nuget:?package=Atc.XamlToolkit&version=1.5.75
ATC.Net WPF, WinUI, and Avalonia
This is a base libraries for building WPF, WinUI, or Avalonia application with the MVVM design pattern.
📑 Table of Contents
- Key Features
- Quick Start
- Requirements
- NuGet Packages
- Documentation
- Complete Feature List
- Why Choose Atc.XamlToolkit?
- How to Contribute
🎁 Key Features
🏗️ MVVM Foundation
- ViewModelBase - Base class with INotifyPropertyChanged
- MainWindowViewModelBase - Main window lifecycle management
- ViewModelDialogBase - Dialog-specific ViewModels
- ObservableObject - Lightweight observable pattern
⚡ Commands
- RelayCommand /
RelayCommand<T>- Synchronous commands withCanExecutesupport - RelayCommandAsync /
RelayCommandAsync<T>- Async/await commands for responsive UIs with cancellation token support - Automatic CanExecute refresh - Commands automatically update UI state
- Error handling support - Built-in
IErrorHandlerinterface for graceful error management
🔔 Messaging System
Decouple your ViewModels with a powerful messaging infrastructure:
- Messenger - Central message bus for app-wide communication
- GenericMessage<T> - Send typed messages between components
- NotificationMessage - Simple notifications with optional callbacks
- PropertyChangedMessage<T> - Broadcast property changes across ViewModels
Perfect for scenarios like:
- Cross-ViewModel communication without direct references
- Event aggregation patterns
- Plugin architectures
- Loosely-coupled component communication
// Send a message
Messenger.Default.Send(new GenericMessage<User>(currentUser));
// Receive a message
Messenger.Default.Register<GenericMessage<User>>(this, msg =>
{
var user = msg.Content;
// Handle the user...
});
Learn more: Messaging System Documentation
🎭 Behaviors
Attach declarative behaviors to UI elements without code-behind. All behaviors work seamlessly across WPF, WinUI, and Avalonia platforms.
EventToCommandBehavior
Execute commands in response to any UI event, eliminating the need for code-behind event handlers.
- Works with any routed or standard .NET event
- Optional
CommandParameterfor passing custom data PassEventArgsToCommandto access event details- Perfect for maintaining clean MVVM architecture
<Button Content="Save">
<i:Interaction.Behaviors>
<behaviors:EventToCommandBehavior
EventName="Click"
Command="{Binding SaveCommand}" />
</i:Interaction.Behaviors>
</Button>
Learn more about EventToCommandBehavior
AnimationBehavior
Provides simple, declarative animations for UI elements without writing animation code.
- 8 animation types: FadeIn, FadeOut, SlideInFromLeft/Right/Top/Bottom, ScaleIn, ScaleOut
- Trigger-based or auto-start animations
- Customizable duration
- GPU-accelerated for smooth performance
<Border Background="LightBlue" Padding="20">
<i:Interaction.Behaviors>
<behaviors:AnimationBehavior
AnimationType="FadeIn"
Duration="1000"
AutoStart="True" />
</i:Interaction.Behaviors>
<TextBlock Text="I fade in automatically!" />
</Border>
Learn more about AnimationBehavior
FocusBehavior
Manages focus for UI elements declaratively through XAML properties.
- HasInitialFocus - Set focus when element loads
- IsFocused - Two-way bindable focus state
- SelectAllOnFocus - Automatically select text in TextBox
- FocusTrigger - Trigger focus from ViewModel
<TextBox Width="300">
<i:Interaction.Behaviors>
<behaviors:FocusBehavior
IsFocused="{Binding IsFieldFocused, Mode=TwoWay}"
SelectAllOnFocus="True" />
</i:Interaction.Behaviors>
</TextBox>
Learn more about FocusBehavior
KeyboardNavigationBehavior
Enables custom keyboard navigation with arrow keys, Enter, Escape, and Tab through declarative command bindings.
- Arrow key navigation (Up, Down, Left, Right)
- Action keys (Enter, Escape, Tab)
- Enable/disable toggle
- Perfect for grids, lists, and custom controls
<Border Focusable="True">
<i:Interaction.Behaviors>
<behaviors:KeyboardNavigationBehavior
UpCommand="{Binding NavigateUpCommand}"
DownCommand="{Binding NavigateDownCommand}"
LeftCommand="{Binding NavigateLeftCommand}"
RightCommand="{Binding NavigateRightCommand}"
EnterCommand="{Binding SelectCommand}" />
</i:Interaction.Behaviors>
</Border>
Learn more about KeyboardNavigationBehavior
Complete Behaviors Documentation: Behaviors Overview
🎨 Value Converters
Extensive collection of ready-to-use XAML converters for WPF, WinUI, and Avalonia:
Bool Converters
BoolToInverseBoolValueConverterBoolToVisibilityCollapsedValueConverterBoolToVisibilityVisibleValueConverterBoolToWidthValueConverterMultiBoolToBoolValueConverter(AND/OR logic)MultiBoolToVisibilityVisibleValueConverter
String Converters
StringNullOrEmptyToBoolValueConverterStringNullOrEmptyToInverseBoolValueConverterStringNullOrEmptyToVisibilityVisibleValueConverterStringNullOrEmptyToVisibilityCollapsedValueConverterToLowerValueConverter/ToUpperValueConverter
Null Converters
NullToVisibilityCollapsedValueConverterNullToVisibilityVisibleValueConverter
See detailed Value Converters documentation
⚙️ Source Generators
Eliminate boilerplate with powerful code generation:
- [ObservableProperty] - Auto-generate properties with change notification
- [ComputedProperty] - Auto-detect dependencies for computed properties and generate automatic notifications
- [RelayCommand] - Auto-generate command properties from methods
- [ObservableDtoViewModel] - Auto-generate ViewModel wrappers for DTOs/POCOs with:
IsDirtytracking for change detectionInnerModelaccess to underlying DTO- Support for readonly properties
- Method proxy generation
- Selective generation with
IgnorePropertyNamesandIgnoreMethodNames - Automatic validation attribute copying with
EnableValidationOnPropertyChangedandEnableValidationOnInit - Support for
[ComputedProperty]with automatic dependency tracking
- [DependencyProperty] (WPF & WinUI 3) - Auto-generate dependency properties
- [StyledProperty] (Avalonia) - Auto-generate styled properties
- [AttachedProperty] (WPF, WinUI 3 & Avalonia) - Auto-generate attached properties
- [RoutedEvent] (WPF only) - Auto-generate routed events
Note: Classes using
[DependencyProperty],[AttachedProperty],[StyledProperty], or[RoutedEvent]must either inherit fromUserControl/DependencyObject/FrameworkElement, or have a class name ending with "Attach", "Behavior", or "Helper" (e.g.,DragBehavior,CheckBoxHelper).
Learn more about each generator:
- SourceGenerators for AttachedProperties
- SourceGenerators for DependencyProperties
- SourceGenerators for RoutedEvents
- SourceGenerators for ViewModel
🚀 Performance Optimizations
- BooleanBoxes - Cached boolean boxing for reduced memory allocations
- WeakAction/WeakFunc - Memory-leak prevention for event handlers and callbacks
- PropertyDefaultValueConstants - Shared default values for common property types
🔧 Utilities
- DesignModeHelper - Detect design-time vs runtime for better designer experience
- Base Converter Classes -
ValueConverterBaseandMultiValueConverterBasefor creating custom converters - Error Handling -
IErrorHandlerinterface for centralized command error management
🚀 Quick Start
Installation
Install via NuGet Package Manager or .NET CLI:
For WPF:
dotnet add package Atc.XamlToolkit.Wpf
For WinUI:
dotnet add package Atc.XamlToolkit.WinUI
For Avalonia:
dotnet add package Atc.XamlToolkit.Avalonia
Basic Usage
// Create a ViewModel with source-generated properties and commands
public partial class MainViewModel : ViewModelBase
{
[ObservableProperty]
private string userName;
[ObservableProperty]
private bool isLoading;
[RelayCommand]
private async Task LoadDataAsync()
{
IsLoading = true;
// Load data...
IsLoading = false;
}
}
📖 Read the full Getting Started Guide for a complete walkthrough.
Requirements
- .NET >= 9.0.202 - SDK
- .NET 9 - Runtime for Avalonia
- .NET 9 - Desktop Runtime for WPF
- .NET 9 - Desktop Runtime for WinUI 3
NuGet Packages Provided in this Repository
📚 Documentation
Get Started
- Getting Started Guide - Complete walkthrough for beginners
Core Concepts
- MVVM Framework - ViewModels, Commands, and MVVM patterns
- Async Command Cancellation - CancellationToken support for async commands
- Messaging System - Decoupled communication between components
- Behaviors - EventToCommandBehavior and declarative behaviors
- Source Generators - Eliminate boilerplate code
Advanced Topics
- Value Converters - Complete converter reference
- Performance Optimizations - BooleanBoxes, WeakAction, and more
- Utilities and Helpers - DesignModeHelper, base classes, and utilities
Platform-Specific (WPF Only)
- Dependency Properties - Auto-generate dependency properties
- Attached Properties - Auto-generate attached properties
- Routed Events - Auto-generate routed events
Source Generator Examples
Example for ViewModel classes with source generation:
For more details, see the MVVM section.
🎯 Complete Feature List
Core MVVM Components
| Component | Description | Package |
|---|---|---|
ViewModelBase |
Base ViewModel with INotifyPropertyChanged | Atc.XamlToolkit |
MainWindowViewModelBase |
Main window lifecycle management | Atc.XamlToolkit.Wpf/WinUI/Avalonia |
ViewModelDialogBase |
Dialog-specific ViewModels | Atc.XamlToolkit |
ObservableObject |
Lightweight observable pattern | Atc.XamlToolkit |
Commands
| Command | Description | Async Support |
|---|---|---|
RelayCommand |
Synchronous command | No |
RelayCommand<T> |
Synchronous command with parameter | No |
RelayCommandAsync |
Asynchronous command | Yes |
RelayCommandAsync<T> |
Asynchronous command with parameter | Yes |
All commands support:
- ✅
CanExecutewith automatic refresh - ✅ Error handling via
IErrorHandler - ✅ Auto-generation via
[RelayCommand]attribute - ✅ Cancellation token support for async commands
Messaging System
| Type | Purpose |
|---|---|
Messenger |
Central message bus |
GenericMessage<T> |
Typed message passing |
NotificationMessage |
String-based notifications |
NotificationMessageAction |
Messages with callbacks |
NotificationMessageAction<T> |
Messages with parameterized callbacks |
PropertyChangedMessage<T> |
Property change broadcasts |
NotificationMessageWithCallback |
Generic callback support |
Source Generators
| Generator | Platform | Description |
|---|---|---|
[ObservableProperty] |
WPF, WinUI, Avalonia | Auto-generate observable properties |
[ComputedProperty] |
WPF, WinUI, Avalonia | Auto-detect dependencies for computed properties and generate automatic property change notifications |
[RelayCommand] |
WPF, WinUI, Avalonia | Auto-generate command properties |
[DependencyProperty] |
WPF, WinUI | Auto-generate dependency properties |
[StyledProperty] |
Avalonia | Auto-generate styled properties (Avalonia's equivalent to DependencyProperty) |
[AttachedProperty] |
WPF, WinUI, Avalonia | Auto-generate attached properties |
[RoutedEvent] |
WPF only | Auto-generate routed events (WPF's EventManager pattern not available in WinUI/Avalonia) |
[ObservableDtoViewModel] |
WPF, WinUI, Avalonia | Auto-generate DTO wrapper with readonly properties, method proxies, IgnorePropertyNames/IgnoreMethodNames, IsDirty, InnerModel, automatic validation attribute copying, and [ComputedProperty] support |
Note on Routed Events: Routed events are a WPF-exclusive feature that uses
EventManager.RegisterRoutedEvent()and supports event bubbling/tunneling through the visual tree. WinUI 3 and Avalonia use different event systems and do not support custom routed events. See the RoutedEvents documentation for detailed platform comparison.
Value Converters
Bool Converters (WPF, WinUI & Avalonia):
BoolToInverseBoolValueConverterBoolToVisibilityCollapsedValueConverterBoolToVisibilityVisibleValueConverterBoolToWidthValueConverterMultiBoolToBoolValueConverterMultiBoolToVisibilityVisibleValueConverter
String Converters (WPF, WinUI & Avalonia):
StringNullOrEmptyToBoolValueConverterStringNullOrEmptyToInverseBoolValueConverterStringNullOrEmptyToVisibilityVisibleValueConverterStringNullOrEmptyToVisibilityCollapsedValueConverterToLowerValueConverterToUpperValueConverter
Null Converters (WPF, WinUI & Avalonia):
NullToVisibilityCollapsedValueConverterNullToVisibilityVisibleValueConverter
Performance Optimizations
| Optimization | Benefit |
|---|---|
BooleanBoxes |
Zero-allocation boolean boxing |
WeakAction |
Memory leak prevention |
WeakFunc<T> |
Memory leak prevention with return values |
PropertyDefaultValueConstants |
Shared default values |
Utilities
| Utility | Purpose |
|---|---|
DesignModeHelper |
Detect design-time vs runtime |
ValueConverterBase |
Base class for custom converters |
MultiValueConverterBase |
Base class for multi-value converters |
IErrorHandler |
Centralized error handling |
🌟 Why Choose Atc.XamlToolkit?
- ✅ Modern - Built for .NET 9 with latest C# features
- ✅ Cross-platform - Supports WPF, WinUI 3, and Avalonia
- ✅ High Performance - Optimized for minimal allocations
- ✅ Source Generators - Eliminate boilerplate code
- ✅ Well Documented - Comprehensive documentation and examples
- ✅ Battle Tested - Used in production applications
- ✅ Open Source - MIT licensed and community-driven
How to contribute
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Atc (>= 2.0.562)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Atc.XamlToolkit:
| Package | Downloads |
|---|---|
|
Atc.Wpf
A base library for building WPF application with the MVVM design pattern. |
|
|
Atc.Wpf.Controls
A base library for building WPF application. |
|
|
Atc.XamlToolkit.Wpf
Atc.XamlToolkit.Wpf is a library for building WPF applications using the MVVM design pattern. |
|
|
Atc.XamlToolkit.Avalonia
Atc.XamlToolkit.Avalonia is a library for building Avalonia applications using the MVVM design pattern. |
|
|
Atc.XamlToolkit.WinUI
Atc.XamlToolkit.WinUI is a library for building WinUI applications using the MVVM design pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.75 | 25 | 10/27/2025 |
| 1.5.74 | 35 | 10/26/2025 |
| 1.5.67 | 87 | 10/24/2025 |
| 1.5.63 | 167 | 10/20/2025 |
| 1.5.62 | 171 | 10/19/2025 |
| 1.5.44 | 203 | 10/5/2025 |
| 1.5.43 | 183 | 10/2/2025 |
| 1.5.42 | 328 | 5/12/2025 |
| 1.5.41 | 242 | 5/11/2025 |
| 1.5.40 | 232 | 5/11/2025 |
| 1.5.39 | 116 | 5/10/2025 |
| 1.5.38 | 116 | 5/9/2025 |
| 1.5.37 | 204 | 5/8/2025 |
| 1.5.36 | 203 | 5/6/2025 |
| 1.5.35 | 175 | 5/6/2025 |
| 1.5.34 | 224 | 5/5/2025 |
| 1.5.33 | 191 | 5/4/2025 |
| 1.5.30 | 205 | 5/4/2025 |
| 1.5.28 | 190 | 4/30/2025 |
| 1.5.26 | 222 | 4/23/2025 |
| 1.5.25 | 196 | 4/23/2025 |
| 1.5.24 | 215 | 4/22/2025 |
| 1.5.23 | 205 | 4/22/2025 |
| 1.5.22 | 203 | 4/22/2025 |
| 1.5.21 | 210 | 4/21/2025 |
| 1.5.20 | 219 | 4/21/2025 |
| 1.5.19 | 207 | 4/21/2025 |
| 1.5.18 | 184 | 4/20/2025 |
| 1.5.16 | 203 | 4/20/2025 |
| 1.5.15 | 225 | 4/10/2025 |
| 1.5.14 | 199 | 4/10/2025 |
| 1.5.12 | 222 | 4/10/2025 |
| 1.5.7 | 228 | 4/5/2025 |
| 1.4.4 | 145 | 4/5/2025 |
| 1.4.0 | 226 | 3/27/2025 |
| 1.3.1 | 204 | 3/26/2025 |
| 1.0.0 | 535 | 3/26/2025 |