Skip to content

How to customise style Headers

whistyun edited this page Dec 5, 2020 · 2 revisions

Abstract

All Headers are created as CTextBlock which has 'Header*' class.

Example

Style

<!--
    xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia"
-->

<Style Selector="ctxt|CTextBlock.Heading1">
    <Setter Property="FontSize" Value="15"/>
    <Setter Property="Foreground" Value="Red"/>
</Style>
<Style Selector="ctxt|CTextBlock.Heading2">
    <Setter Property="FontSize" Value="17"/>
    <Setter Property="Foreground" Value="Blue"/>
</Style>
<Style Selector="ctxt|CTextBlock.Heading3">
    <Setter Property="FontSize" Value="19"/>
    <Setter Property="Foreground" Value="Green"/>
</Style>
<Style Selector="ctxt|CTextBlock.Heading4">
    <Setter Property="FontSize" Value="21"/>
    <Setter Property="Foreground" Value="Yellow"/>
</Style>
<Style Selector="ctxt|CTextBlock.Heading5">
    <Setter Property="FontSize" Value="24"/>
    <Setter Property="Foreground" Value="Magenta"/>
</Style>
<Style Selector="ctxt|CTextBlock.Heading6">
    <Setter Property="FontSize" Value="27"/>
    <Setter Property="Foreground" Value="Cyan"/>
</Style>

Markdown

# Heading1
## Heading2
### Heading3
#### Heading4
##### Heading5
###### Heading6

View

view

Support Styles

  • Background
  • FontFamily
  • FontSize
  • FontStyle
  • FontWeight
  • Foreground
  • TextAlignment