Border

Note: You can check the Avalonia docs for the Border and Border Api if you need more information.

For Avalonia.FuncUI's DSL properties you can check Border.fs

The Border control allows you to decorate child controls

Usage

Set Background Avalonia.FuncUI has some overloads for you to take advantage of

Border.create [
  Border.background "black"
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]
Border.create [
  Border.background "#000000"
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

You can pass any IBrush compatible instance to the background for more control

Set Border Brush Avalonia.FuncUI has some overloads for you to take advantage of

Border.create [
  Border.borderBrush "red"
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]
Border.create [
  Border.borderBrush "#FF0000"
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

You can pass any IBrush compatible instance to the background for more control

Thickness

Border.create [
  Border.borderThickness 2.0
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

Horizontal and Vertical Thickness

Border.create [
  Border.borderThickness (2.0, 5.0)
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

Left, Top, Right, Bottom Thickness

Border.create [
  Border.borderThickness (1.0, 2.0, 3.0, 4.0)
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

You can also pass a Thickness struct to the borderThickness property

Corner Radius

Border.create [
  Border.cornerRadius 3.0
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

Horizontal and Vertical Corner Radius

Border.create [
  Border.cornerRadius (2.0, 5.0)
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

Left, Top, Right, Bottom Corner Radius

Border.create [
  Border.cornerRadius (1.0, 2.0, 3.0, 4.0)
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

You can also pass a Corner Radius struct to the cornerRadius property

Border.create [
  Border.cornerRadius (CornerRadius 3.0)
  Border.child (StackPanel.create [ /* ... definition ... */ ])
]

Last updated