Styling
The most obvious difference from other XAML frameworks is that Avalonia uses a CSS-like styling system. Styles aren't stored in a Resources collection as in WPF, they are stored in a separate Styles collection:
1
<UserControl>
2
<UserControl.Styles>
3
<!-- Make TextBlocks with the h1 style class have a font size of 24 points -->
4
<Style Selector="TextBlock.h1">
5
<Setter Property="FontSize" Value="24"/>
6
</Style>
7
</UserControl.Styles>
8
<TextBlock Classes="h1">Header</TextBlock>
9
<UserControl>
Copied!
Last modified 21d ago
Export as PDF
Copy link