0103d383a0 | ||
---|---|---|
.. | ||
README.md | ||
resources.md | ||
selectors.md | ||
styles.md | ||
troubleshooting.md |
README.md
🎨 Styling
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"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Styles>
<Style Selector="TextBlock.h1">
<Setter Property="FontSize" Value="24"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</Window.Styles>
<TextBlock Classes="h1">I'm a Heading!</TextBlock>
</Window>