Table of Contents

Class StackPanel

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

Base class for containers that arrange children in a stack (either horizontally or vertically).

public abstract class StackPanel : Container, IItemWithId, INotifyAttachedPropertyChanged, IContainer
Inheritance
StackPanel
Implements
Derived
Inherited Members

Constructors

StackPanel()

Initializes a new instance of the StackPanel class.

protected StackPanel()

Fields

ProportionTypeProperty

Attached property that specifies the proportion type for a child element in a stack panel.

public static readonly AttachedPropertyInfo<ProportionType> ProportionTypeProperty

Field Value

AttachedPropertyInfo<ProportionType>

ProportionValueProperty

Attached property that specifies the proportion value for a child element in a stack panel.

public static readonly AttachedPropertyInfo<float> ProportionValueProperty

Field Value

AttachedPropertyInfo<float>

Properties

DefaultProportion

Gets or sets the default proportion for child elements.

[Browsable(false)]
public Proportion DefaultProportion { get; set; }

Property Value

Proportion

GridLinesColor

Gets or sets the color of the grid lines shown for debugging.

public Color GridLinesColor { get; set; }

Property Value

Color

Orientation

Gets the orientation of the stack panel (horizontal or vertical).

[Browsable(false)]
public abstract Orientation Orientation { get; }

Property Value

Orientation

ShowGridLines

Gets or sets a value indicating whether grid lines should be shown for debugging.

public bool ShowGridLines { get; set; }

Property Value

bool

Spacing

Gets or sets the spacing between child elements.

public int Spacing { get; set; }

Property Value

int

Methods

CopyFrom(Widget)

Copies properties from another stack panel to this one.

protected override void CopyFrom(Widget w)

Parameters

w Widget

The source stack panel to copy from.

GetCellSize(int)

Gets the size of the cell at the specified index.

public int GetCellSize(int index)

Parameters

index int

The zero-based index of the cell.

Returns

int

The size of the cell.

GetProportionType(Widget)

Gets the proportion type for a widget in a stack panel.

public static ProportionType GetProportionType(Widget widget)

Parameters

widget Widget

The widget.

Returns

ProportionType

The proportion type of the widget.

GetProportionValue(Widget)

Gets the proportion value for a widget in a stack panel.

public static float GetProportionValue(Widget widget)

Parameters

widget Widget

The widget.

Returns

float

The proportion value of the widget.

InternalArrange()

Arranges child elements in the stack panel according to the stack orientation.

protected override void InternalArrange()

InternalMeasure(Point)

Measures the size required for all child elements in the stack panel.

protected override Point InternalMeasure(Point availableSize)

Parameters

availableSize Point

The available size for measurement.

Returns

Point

The measured size of the stack panel.

InternalRender(RenderContext)

Renders the stack panel and optionally its grid lines for debugging.

public override void InternalRender(RenderContext context)

Parameters

context RenderContext

The render context.

OnAttachedPropertyChanged(BaseAttachedPropertyInfo)

Handles changes to attached properties on the stack panel.

public override void OnAttachedPropertyChanged(BaseAttachedPropertyInfo propertyInfo)

Parameters

propertyInfo BaseAttachedPropertyInfo

Information about the changed property.

SetProportionType(Widget, ProportionType)

Sets the proportion type for a widget in a stack panel.

public static void SetProportionType(Widget widget, ProportionType value)

Parameters

widget Widget

The widget.

value ProportionType

The proportion type to set.

SetProportionValue(Widget, float)

Sets the proportion value for a widget in a stack panel.

public static void SetProportionValue(Widget widget, float value)

Parameters

widget Widget

The widget.

value float

The proportion value to set.

UpdateChildren()

Updates the proportions of child elements in the stack panel.

protected void UpdateChildren()