Samples
Model-View-ViewModel (MVVM)
Basic MVVM
This sample will show you how you can use the MVVM-pattern to receive and process text input by the user.
Binding & Converters
This sample will show you how you can use use bindings and converters to convert a Date to a string value (calculating the age of a person).
Commands
This sample will show you how you can use Commands to invoke methods in your ViewModel from your user interface.
ValueConverter
In this sample you will learn how you can use a Converter inside your Binding in order to calculate a new value for the View.
Data Validation
This sample you will learn how to validate properties and display an error message to the user, if the entered values are invalid.
Dialogs
This sample will show you how to use Reactive UI Interactions to show [dialogs] in your MVVM application
Dialog Manager
This sample will show you how to write a service (we will call it dialog manager) that will help you to show dialogs in your MVVM application
DataTemplates
Basic DataTemplate
This sample will show you how you can use DataTemplates to control how your data is displayed.
FuncDataTemplate
This sample will show you how to use a FuncDataTemplate to create an advanced DataTemplate in code.
IDataTemplate
This sample will show you how to implement IDataTemplate in your own class to have full control over your DataTemplates.
Controls, Styles & Drawing
Customized Button
This sample will show you how to customize the style of a button by creating reusable styles.
Making Lists
This sample will show you how to create lists of data using Bindings and a ListBox control
Splash Screen
This sample will show you how to create a custom Splash Screen that loads before your MainWindow
Rect Painter
This sample will show you how to create a custom rendered control which interacts with the mouse, to form a simple paint application.
Image Loading
This sample will show you how to load images via XAML, Bindings and from the internet.
Using Google Fonts
This sample will show you how to use Google fonts within your application
BattleCity
The purpose of the sample is to demonstrate that how to create a 2D game in Avalonia without writing any rendering code.
Custom Controls
Custom Rating Control
This sample will show you how to create a custom control. The goal is to create a rating control, where the user can vote via clicking one of several stars.
Custom Snowflakes Control
This sample will show you how to create a custom control that overrides OnRender in order to have advanced render capabilities.
Miscellaneous
Clipboard Operations
This sample demonstrates how to interat with the devices clipboard and copy and paste text.
Drag and Drop Operations
This sample demonstrates how to implement dragging and dropping within your Avalonia application.
Native File Dialogs
This sample demonstrates how to use the native Save As and Open File dialogs.
Basic Localization
This sample demonstrates how to localize your Avalonia application.
Basic Inversion of Control
This sample demonstrates how to use the native Save As and Open File dialogs with IoC.
Basic ViewLocator
This sample will show you how to use a ViewLocator in order to change the contents of your UI.
Native AOT
This sample will show you how to setup your application for building with Native AOT
Automated UI Testing
Headless Testing with XUnit
This sample will show you how the headless platform in Avalonia provides the capability to run Avalonia applications without a visible graphical user interface
Headless Testing with NUnit
This sample will show you how the headless platform in Avalonia provides the capability to run Avalonia applications without a visible graphical user interface
Testing with Appium
Automated tests for UI interactions, such as button clicks, text input, and screen navigation.