Skip to main content
Avalonia UI provides a comprehensive set of controls for building desktop applications. Controls are the building blocks of your user interface, from simple text displays to complex data grids.

Control Categories

Layout Controls

Arrange and organize child elements - Grid, StackPanel, DockPanel, Canvas

Input Controls

Receive user input - Button, TextBox, CheckBox, ComboBox, Slider

Display Controls

Display content and information - TextBlock, Image, Border, ProgressBar

Navigation Controls

Enable navigation between views - TabControl, Menu, TreeView

Base Classes

All controls in Avalonia inherit from a hierarchy of base classes:
  • Control: Base class for all controls, extends InputElement with Tag property
  • ContentControl: Displays content according to a data template
  • TemplatedControl: Control with customizable visual template
  • Panel: Base class for layout controls that arrange children

Common Properties

Most controls share common properties inherited from base classes:
<Button 
  Width="120" 
  Height="40"
  Margin="10"
  Padding="5"
  HorizontalAlignment="Center"
  VerticalAlignment="Top"
  IsEnabled="True"
  IsVisible="True"
  Background="#007ACC"
  Foreground="White" />

Styling Controls

Controls can be styled using Styles and ControlThemes:
<Window.Styles>
  <Style Selector="Button">
    <Setter Property="Background" Value="#007ACC" />
    <Setter Property="Foreground" Value="White" />
    <Setter Property="Padding" Value="8,4" />
  </Style>
  
  <Style Selector="Button:pointerover">
    <Setter Property="Background" Value="#1E88E5" />
  </Style>
</Window.Styles>

Data Binding

Controls support data binding to connect UI with your application logic:
<TextBox Text="{Binding UserName, Mode=TwoWay}" />
<TextBlock Text="{Binding StatusMessage}" />
<Button Content="Submit" Command="{Binding SubmitCommand}" />

Creating Custom Controls

For specialized needs, you can create custom controls. See the Custom Controls guide for details.

Next Steps

Layout Controls

Learn about Grid, StackPanel, and other layout controls

Input Controls

Explore buttons, text boxes, and form controls

Build docs developers (and LLMs) love