Use this file to discover all available pages before exploring further.
The layout API is the foundation of every Prowl.Paper UI. Every visual element begins its life with a set of sizing and positioning rules that the layout engine resolves once per frame, before any rendering occurs. All methods below are defined on StyleSetterBase<T> (inherited by ElementBuilder) or directly on ElementBuilder, and every one returns ElementBuilder for fluent chaining unless otherwise noted.
These methods control how large an element is. Sizes are expressed as UnitValue, which can be a pixel amount, a percentage of the parent, a stretch factor, or Auto.
Provides a custom sizing callback for elements whose natural size is driven by content (text blocks, images, custom controls). The engine calls sizer(maxWidth, maxHeight) during layout; either constraint may be null when unconstrained. Return null from the callback if sizing is impossible under the given constraints.
These methods set where an element appears within its parent’s coordinate space. They map directly to the layout engine’s Left, Right, Top, and Bottom style properties. Their behaviour depends on PositionType (see below).
Set one edge at a time. For ParentDirected elements these act as margin (spacing around the element inside the parent’s flow). For SelfDirected elements they act as absolute offsets from the corresponding parent edge.
Margin is the outer spacing around an element. Under the hood, setting margin on a child sets that child’s Left/Right/Top/Bottom style properties. When these are Auto, the parent’s ChildLeft/ChildRight/ChildTop/ChildBottom/RowBetween/ColBetween defaults fill in — which is how alignment recipes work.
Setting a concrete pixel margin on a side opts that side out of the parent’s default ChildLeft/ChildRight/ChildTop/ChildBottom fill-in. Use UnitValue.Auto explicitly to re-enable parent-side defaulting.
Padding is the inner inset on a parent element. It shrinks the content area that children are placed into, and an auto-sized parent grows to include the padding in its outer size.
These methods are called on a parent element and set the default spacing slots around and between its children. By combining Stretch values in different slots you express the full range of CSS justify-content behaviour without any extra wrapper element.
RowBetween fills the gap between siblings in a column-direction container (i.e., between rows). ColBetween fills the gap between siblings in a row-direction container (i.e., between columns). The naming follows the axis being separated, not the container direction.
The following recipes are set on the parent element. Children use default (Auto) margins.
CSS equivalent
Row container recipe
Column container recipe
justify-content: flex-start
(default — no call needed)
(default — no call needed)
justify-content: flex-end
.ChildLeft()
.ChildTop()
justify-content: center
.ChildLeft().ChildRight()
.ChildTop().ChildBottom()
justify-content: space-between
.ColBetween()
.RowBetween()
justify-content: space-around
.ChildLeft().ChildRight().ColBetween()
.ChildTop().ChildBottom().RowBetween()
using (Paper.Element("toolbar").LayoutType(LayoutType.Row) .ChildLeft().ChildRight() .Enter()){ // children are centered horizontally Paper.Element("btn-a").Size(UnitValue.Pixels(80), UnitValue.Pixels(32)); Paper.Element("btn-b").Size(UnitValue.Pixels(80), UnitValue.Pixels(32));}
PositionType.ParentDirected — the element participates in the parent’s normal flow (default). PositionType.SelfDirected — the element is removed from flow and positioned absolutely relative to its parent.
// Floating tooltip anchored to the top-right of its parentPaper.Element("tooltip") .PositionType(PositionType.SelfDirected) .Right(UnitValue.Pixels(0)) .Top(UnitValue.Pixels(0));
Keeps the element’s final screen rectangle fully within the viewport after layout. Children move with it. Works for both ParentDirected and SelfDirected elements. Ideal for context menus or drag-repositioned panels that should never go off-screen.
Rendering layer. Higher values draw on top and are hit-tested first. Use the named constants in Layer for the three built-in tiers, or any integer for fine-grained control.
Constant
Value
Intended use
Layer.Base
0
Normal UI content
Layer.Overlay
100
Modals, dropdowns
Layer.Topmost
200
Tooltips, popovers
Paper.Element("modal-backdrop") .Layer(Layer.Overlay) .Size(UnitValue.StretchOne, UnitValue.StretchOne);Paper.Element("tooltip") .Layer(Layer.Topmost);// Fine-grained: wedge between Overlay and TopmostPaper.Element("notification") .Layer(Layer.Overlay + 10);
Opens a parent scope so that elements created inside the using block become children of this element. Dispose (end of using) automatically pops the scope.