Skip to main content
Version: 0.10.x

Data Binding

Avalonia includes comprehensive support for binding between controls and to arbitrary .NET objects. Data binding can be set up in XAML or in code and supports:

The following example shows a TextBlock when an associated TextBox is disabled, by using a binding:

<TextBox Name="input" IsEnabled="False"/>
<TextBlock IsVisible="{Binding !#input.IsEnabled}">Sorry, no can do!</TextBlock>

In this example, a binding is set up to the IsEnabled property of the input control using #input.IsEnabled and the value of that binding is negated and fed into the TextBlock.IsVisible property.