Class Decoration
A purely visual mark pinned to a corner or edge of a view - corner flourishes, framing rules, a watermark.
public class Decoration
- Inheritance
-
Decoration
- Inherited Members
Remarks
Deliberately not a UIElement: a decoration never enters the layout tree's measure/arrange pass, never reserves flow space, and is never hit-tested or focusable. That's the whole reason it exists - the layout system is Stack/Dock/Grid only, and there's no way to ask any of them for a zero-footprint mark in a corner. Docking one would reserve a strip along an entire edge.
Properties
Anchor
The point of the view the decoration is pinned to. Offset is measured inward from it.
public DecorationAnchor Anchor { get; set; }
Property Value
BorderColor
The colour of the border, or null for none.
public Color? BorderColor { get; set; }
Property Value
BorderThickness
The border's width in pixels. A border is drawn only when this is above 0 and BorderColor is set.
public int BorderThickness { get; set; }
Property Value
FillColor
A flat colour behind the decoration, or null for none. FillGradient takes its place when both are set.
public Color? FillColor { get; set; }
Property Value
FillGradient
A gradient fill, drawn in place of FillColor when both are set. Null for none.
public Gradient FillGradient { get; set; }
Property Value
Layer
Whether this is painted under the control tree or over it.
public DecorationLayer Layer { get; set; }
Property Value
Offset
Distance inward from Anchor. Ignored on a centered axis.
public Vector2 Offset { get; set; }
Property Value
Size
The size of the decoration, in pixels. Ignored when Stretch is set.
public Vector2 Size { get; set; }
Property Value
Stretch
Covers the whole view, whatever its size, ignoring Anchor, Offset and Size - for a page background or a scrim. The UI lays out in the window's real pixels, so a fixed "big enough" size is only big enough for some windows.
public bool Stretch { get; set; }
Property Value
Texture
A texture drawn over the fill and border, or null for none.
public ITexture Texture { get; set; }
Property Value
TextureColor
The tint applied to Texture. White leaves it as it is.
public Color TextureColor { get; set; }
Property Value
Methods
ResolveBounds(float, float)
Works out where the decoration is drawn in a view of the given size, in pixels.
public Rectangle ResolveBounds(float viewWidth, float viewHeight)