CheckBox
The CheckBox control is a ContentControl which allows user to check an option. It is usually used to display a boolean option where selection is either checked or unchecked. But it also supports three state mode where selection is either checked, indeterminate or unchecked.

Common Properties

Property
Description
IsChecked
Is CheckBox checked
IsThreeState
Is CheckBox in three state mode

Reference

​Checkbox​

Source code

​CheckBox.cs​

Examples

Basic checkbox

1
<Window xmlns="https://github.com/avaloniaui"
2
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
6
x:Class="AvaloniaAppTemplate.MainWindow"
7
Title="CheckBox sample">
8
<StackPanel>
9
<CheckBox>Not checked by default</CheckBox>
10
<CheckBox IsChecked="True">Checked by default</CheckBox>
11
</StackPanel>
12
</Window>
Copied!
produces following output with Windows 10
Basic checkbox

Three state checkbox

1
<Window xmlns="https://github.com/avaloniaui"
2
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
6
x:Class="AvaloniaAppTemplate.MainWindow"
7
Title="CheckBox sample">
8
<StackPanel>
9
<CheckBox IsThreeState="True" IsChecked="False">Not checked by default</CheckBox>
10
<CheckBox IsThreeState="True" IsChecked="True">Checked by default</CheckBox>
11
<CheckBox IsThreeState="True" IsChecked="{x:Null}">Indeterminate by default</CheckBox>
12
</StackPanel>
13
</Window>
Copied!
produces following output with Windows 10
Three state checkbox
Last modified 2mo ago