Component basics
Component (fun ctx -> ...)
// create a Component that can be directly used in a Avalonia app
let component: Component = Component (fun ctx ->
TextBlock.create [
TextBlock.text "Hello World!"
]
)
// use component as main view of an app
type MainWindow() as this =
inherit HostWindow()
do
this.Content <- component
// embedd component in avalonia app
let control: ContentControl = ..
control.Content <- component
// Creating a component using the View DSL.
// The resulting IView can be used inside other components and with the View DSL.
Component.create ("key", fun ctx -> ...)
Last updated