TextBlock
Note: You can check the Avalonia docs for the TextBlock and TextBlock API if you need more information.
For Avalonia.FuncUI's DSL properties you can check TextBlock.fs
The textblock control allows you to present text within the application.
Usage
Basic usage
TextBlock.create [
TextBlock.text <text-for-box>
]Properties
You will often want to specify how you want the text to look and TextBlock implements a number of properties to that end
Background You can pass either a basic string or an IBrush instance for more control
TextBlock.create [
TextBlock.background "red"
TextBlock.text "Critical malfunction!"
]Foreground To set the text color, you can again pass either a basic string or an IBrush instance
TextBlock.create [
TextBlock.foreground "green"
TextBlock.text "All systems operational."
]Font The look of the font is specified by way of the fontFamily, fontSize, fontWeight and fontStyle properties
Padding TextBlock allows you to set the padding in several ways
Text formatting Several properties are available to adjust how the content of the TextBlock is formatted
Last updated