Links

Attributes

🔧 Properties

For each .NET Property defined on an Avalonia Control there is a corresponding Attribute. Most of them are Property Attributes, but not all of them.
Button.create [
Button.margin 5.0
Button.content "button text"
]
...

⚡ Events

Events are just like other attributes. You can easily recognize them by their prefix. Events are named like this
{ControlName}.on**{EventName}**
Button.onClick (fun args -> // do something )
TextBox.onKeyDown (fun args -> // do something )
TextBox.onKeyUp (fun args -> // do something )
ListBox.onSelectionChanged (fun args -> // do something )
...

🧲 Attached Properties

Attached Attributes are used like Events and normal Properties.
{ControlName}.{name}
StackPanel.dock Dock.Top
StackPanel.row 1
StackPanel.column 1
...
⚠ Currently not all attached properties are supported / declared. This is currently in process, feel free to create an issue if something is missing

📦 Content Properties

Content Properties are attributes containing either a single View or a list of Views. They are often named content, children, viewItems, … you get it.
Here are some examples.
// single view content
Button.create [
// takes 'View'
Button.content (
TextBlock.create [
TextBlock.text "some text"
]
)
]
// content view list
StackPanel.create [
// takes 'View list'
StackPanel.children [
TextBox.create [
TextBox.text "one"
]
TextBox.create [
TextBox.text "two"
]
...
]
]
Last modified 1mo ago