AvaloniaExtensions

August 9, 2025 · View on GitHub

English | 简体中文

A syntactic sugar library that brings convenience to Avalonia UI development, aiming to enhance development efficiency and experience by providing additional functionality and simplifying common operations.

Install

Install-Package AvaloniaExtensions.Axaml

I18n

https://github.com/dotnet9/Lang.Avalonia

If

Using the Conditional expression in AXAML.

<TextBlock Text="{markup:If Condition={Binding Status}, True=Running, False=NotRunning}" />
<TextBlock Text="{markup:If {Binding Status}, {markup:I18n {x:Static l:Language.Running}}, {markup:I18n {x:Static l:Language.NotRunning}}}" />

Converter Extensions

IfConditionConverter

<markup:IfConditionConverter x:Key="StatusConditionConverter">
            <markup:IfConditionConverter.True>
                <TextBlock Foreground="Green" Text="{markup:I18n {x:Static l:Language.Running}}" />
            </markup:IfConditionConverter.True>
            <markup:IfConditionConverter.False>
                <TextBlock Foreground="DarkOrange" Text="{markup:I18n {x:Static l:Language.NotRunning}}" />
            </markup:IfConditionConverter.False>
        </markup:IfConditionConverter>
<ContentControl Content="{Binding Status, Converter={StaticResource StatusConditionConverter}}" />

Thanks

Taken from open source, contributed to open source. The development of this library was inspired and aided by the following open-source projects or articles:

Special thanks to the contributors of these projects. Their efforts have provided valuable references and assistance for the development of AvaloniaExtensions.