This document captures design and implementation notes for Border.
For end-user usage and examples, see Border.
Border is a Padder, so it also supports user Padding around the content inside the border.Border : PadderBorder()Border(Visual content)Border(Func<Visual> contentFactory)
From Padder / ContentVisual:
Padding : Thickness (bindable)Content : Visual?Border inherits all measurement/arrangement behavior from Padder, and reserves space for its chrome via:
Inset = new Thickness(1)Effective padding used by Padder is:
Padding + InsetThis means:
Padding is applied inside that border.Rendering is purely visual (no input handling) and consists of:
Bounds (including border and interior) is filled with spaces using:
BorderStyle.BackgroundStyle when provided, otherwise Style.None.BorderStyle.Glyphs if set, otherwise theme.Lines.TopLeft, TopRight, BottomLeft, BottomRight) are drawn first.HorizontalVerticalBorderStyle.HighlightOnFocusWithin == true (default), the border uses a “focused” border style when HasFocusWithin is true.Border does not clip differently than other visuals. The framework already clips every visual to its bounds, so the
content cannot draw over the border.
Border does not handle input and does not expose commands. It is purely a visual chrome/layout primitive.
Resolved from the environment via BorderStyle.Key:
Glyphs : LineGlyphs?
Theme.Lines.HighlightOnFocusWithin : bool (default: true)BorderCellStyle : Style?FocusedBorderCellStyle : Style?BackgroundStyle : Style?Predefined convenience styles:
BorderStyle.SingleBorderStyle.RoundedBorderStyle.DoubleBorderStyle.HeavyBorderStyle.AsciiBorderStyle.AsciiHeavyBorderStyle.DashedWhen explicit styles are not provided:
theme.BorderStyle(focused: false)theme.BorderStyle(focused: true)Tests that lock down current behavior:
src/XenoAtom.Terminal.UI.Tests/PadderMeasureArrangeTests.cs (border inset sizing)src/XenoAtom.Terminal.UI.Tests/BorderGroupGlyphStyleRenderTests.cs (ASCII glyph set rendering)Group).