Basic Usage
Using Semi Avalonia is very straightforward. Simply follow the steps in Installation to install and reference the Semi Avalonia style files, and you will achieve a global style upgrade for Avalonia.
Additionally, you can make some very simple configurations in the following ways:
Theme Variables Semi Avalonia includes built-in Light and Dark themes. You can select the default theme for your application by setting the RequestedThemeVariant in Application. Light stands for light theme, Dark for dark theme, and Default means it follows the system color.
<Application
x:Class="Semi.Avalonia.Demo.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"
RequestedThemeVariant="Light"
>
<Application.Styles>
<semi:SemiTheme />
</Application.Styles>
</Application>
Localization
Some built-in controls in Avalonia contain text information (such as the default right-click menu of TextBox). You can choose the language for these texts by setting the Locale of SemiTheme. Semi Avalonia uses Chinese by default, but if you need to use English, you can set it up as follows:
<Application
x:Class="Semi.Avalonia.Demo.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:semi="https://irihi.tech/semi"
>
<Application.Styles>
<semi:SemiTheme Locale="en-US"/>
</Application.Styles>
</Application>
Installation Without Globalization Feature
In some extreme circumstances, Globalization feature may fail your application (e.g. define <InvariantGlobalization>true</InvariantGlobalization>
in project, or operating system that doesn't globalization. ). In such case you can import styles as well as globalization resources independently.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<locale:en_us/> <!-- merge globalization resources -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
<Application.Styles>
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
</Application.Styles>