Перейти к основному содержимому
Версия: 0.10.x


Styles in Avalonia are used to share property settings between controls. The Avalonia styling system can be thought of as a mix of CSS styling and WPF/UWP styling. At its most basic, a style consists of a selector and a collection of setters.

The following style selects any TextBlock in the Window with a h1 style class and sets its font size to 24 point and font weight to bold:

<Window xmlns="https://github.com/avaloniaui"
<Style Selector="TextBlock.h1">
<Setter Property="FontSize" Value="24"/>
<Setter Property="FontWeight" Value="Bold"/>

<TextBlock Classes="h1">I'm a Heading!</TextBlock>