Table of Contents

Class Panel

Namespace
PluginUI
Assembly
PluginUI.dll

Element with children, an optional background/border and padding. Base class of every layout container.

public class Panel : UIElement
Inheritance
Panel
Derived
Inherited Members

Remarks

The default layout stacks every child over the whole content area (like a single-cell grid). Derive and override MeasureOverride(Size) / ArrangeOverride(Rect) to implement a custom layout (see StackPanel for a short example).

Constructors

Panel()

Creates an empty panel.

public Panel()

Properties

Background

Background fill (null = transparent).

public Paint? Background { get; set; }

Property Value

Paint

BorderColor

Border color (transparent = none).

public Color BorderColor { get; set; }

Property Value

Color

BorderThickness

Border thickness in DIPs.

public float BorderThickness { get; set; }

Property Value

float

Children

Children, drawn in order (last = topmost).

public ElementCollection Children { get; }

Property Value

ElementCollection

ContentBounds

Content area (bounds minus padding).

protected Rect ContentBounds { get; }

Property Value

Rect

CornerRadius

Corner radius of the background and border.

public float CornerRadius { get; set; }

Property Value

float

Padding

Inner spacing between the border and the children.

public Thickness Padding { get; set; }

Property Value

Thickness

ShadowBlur

Drop shadow blur radius.

public float ShadowBlur { get; set; }

Property Value

float

ShadowColor

Drop shadow color (transparent = none).

public Color ShadowColor { get; set; }

Property Value

Color

ShadowOffset

Drop shadow offset.

public Point ShadowOffset { get; set; }

Property Value

Point

VisualChildren

Child elements in drawing order (back to front).

public override IReadOnlyList<UIElement> VisualChildren { get; }

Property Value

IReadOnlyList<UIElement>

Methods

Add(params UIElement[])

Adds children (fluent).

public Panel Add(params UIElement[] elements)

Parameters

elements UIElement[]

Returns

Panel

ArrangeOverride(Rect)

Arranges children inside the final bounds.

protected override void ArrangeOverride(Rect bounds)

Parameters

bounds Rect

MeasureOverride(Size)

Natural size of the content for the available size (margins excluded).

protected override Size MeasureOverride(Size available)

Parameters

available Size

Returns

Size

OnRender(DrawingContext)

Draws the element (below its children).

protected override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext