Atc.XamlToolkit is a library for building XAML applications using the MVVM design pattern.
$ dotnet add package Atc.XamlToolkitThis is a base libraries for building WPF, WinUI, or Avalonia application with the MVVM design pattern.
RelayCommand<T> - Synchronous commands with CanExecute supportRelayCommandAsync<T> - Async/await commands for responsive UIs with cancellation token support
IDisposable for proper resource cleanupIErrorHandler interface for graceful error managementDecouple your ViewModels with a powerful messaging infrastructure:
Perfect for scenarios like:
// 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
Attach declarative behaviors to UI elements without code-behind. All behaviors work seamlessly across WPF, WinUI, and Avalonia platforms.
Execute commands in response to any UI event, eliminating the need for code-behind event handlers.
CommandParameter for passing custom dataPassEventArgsToCommand to access event details<!-- WPF Example -->
<Button Content="Save">
<i:Interaction.Behaviors>
<behaviors:EventToCommandBehavior
EventName="Click"
Command="{Binding SaveCommand}" />
</i:Interaction.Behaviors>
</Button>
Learn more about EventToCommandBehavior
Provides simple, declarative animations for UI elements without writing animation code.
<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
Manages focus for UI elements declaratively through XAML properties.
<TextBox Width="300">
<i:Interaction.Behaviors>
<behaviors:FocusBehavior
IsFocused="{Binding IsFieldFocused, Mode=TwoWay}"
SelectAllOnFocus="True" />
</i:Interaction.Behaviors>
</TextBox>
Learn more about FocusBehavior
Enables custom keyboard navigation with arrow keys, Enter, Escape, and Tab through declarative command bindings.
<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
Extensive collection of ready-to-use XAML converters for WPF, WinUI, and Avalonia:
BoolToInverseBoolValueConverterBoolToVisibilityCollapsedValueConverterBoolToVisibilityVisibleValueConverterBoolToWidthValueConverterMultiBoolToBoolValueConverter (AND/OR logic)MultiBoolToVisibilityVisibleValueConverterStringNullOrEmptyToBoolValueConverterStringNullOrEmptyToInverseBoolValueConverterStringNullOrEmptyToVisibilityVisibleValueConverterStringNullOrEmptyToVisibilityCollapsedValueConverterToLowerValueConverter / ToUpperValueConverterNullToVisibilityCollapsedValueConverterNullToVisibilityVisibleValueConverterSee detailed Value Converters documentation
Eliminate boilerplate with powerful code generation:
SupportsCancellation = true generates cancel methods and DisposeCommands() helper for proper resource cleanupIsDirty tracking for change detectionInnerModel access to underlying DTOIgnorePropertyNames and IgnoreMethodNamesEnableValidationOnPropertyChanged and EnableValidationOnInit[ComputedProperty] with automatic dependency trackingNote: 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:
ValueConverterBase and MultiValueConverterBase for creating custom convertersIErrorHandler interface for centralized command error managementInstall 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
// 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.
Example for ViewModel classes with source generation:

For more details, see the MVVM section.
| 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 |
| 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:
CanExecute with automatic refreshIErrorHandler[RelayCommand] attribute| 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 |
| 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.
Bool Converters (WPF, WinUI & Avalonia):
BoolToInverseBoolValueConverterBoolToVisibilityCollapsedValueConverterBoolToVisibilityVisibleValueConverterBoolToWidthValueConverterMultiBoolToBoolValueConverterMultiBoolToVisibilityVisibleValueConverterString Converters (WPF, WinUI & Avalonia):
StringNullOrEmptyToBoolValueConverterStringNullOrEmptyToInverseBoolValueConverterStringNullOrEmptyToVisibilityVisibleValueConverterStringNullOrEmptyToVisibilityCollapsedValueConverterToLowerValueConverterToUpperValueConverterNull Converters (WPF, WinUI & Avalonia):
NullToVisibilityCollapsedValueConverterNullToVisibilityVisibleValueConverter| Optimization | Benefit |
|---|---|
BooleanBoxes | Zero-allocation boolean boxing |
WeakAction | Memory leak prevention |
WeakFunc<T> | Memory leak prevention with return values |
PropertyDefaultValueConstants | Shared default values |
| 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 |