Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 1.24 KB

File metadata and controls

21 lines (15 loc) · 1.24 KB

Data Binding

Avalonia includes comprehensive support for binding between controls and to aribtrary .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:

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

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.