Troubleshooting
Avalonia styling system is a mix of XAML and CSS styling approaches, so developers with knowledge of only one of these technologies can be confused by details of another one.
Let's imagine a problem when one or all style setters are not applied to the control. Below we will list common possible reasons and solutions.
Selector targets a control that doesn't exist
Avalonia selectors, like CSS selectors, do not raise any errors or warnings, when there are no controls which can be matched by the selector. This includes using a name or class that doesn't exist or a child selector when there are no children to match the inner selector. The reason is simple, one style can target many controls, that can be created or removed at runtime, so there is no possible way to validate the selector.
Target property is overridden by another style
Styles are applied in order of declaration. If there are multiple style files that target the same control property, one style can override the other:
<Style Selector="TextBlock.header">
<Style Property="Foreground" Value="Blue" />
<Style Property="FontSize" Value="16" />
</Style>