Table of Contents

Class SingleItemLayout<T>

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

A layout system for containers that hold a single child widget of a specific type.

public class SingleItemLayout<T> : ILayout where T : Widget

Type Parameters

T

The type of widget contained.

Inheritance
SingleItemLayout<T>
Implements
Inherited Members

Constructors

SingleItemLayout(Widget)

Initializes a new instance of the SingleItemLayout<T> class with the specified container.

public SingleItemLayout(Widget container)

Parameters

container Widget

The container widget.

Exceptions

ArgumentNullException

container is null.

Properties

Child

Gets or sets the child widget.

public T Child { get; set; }

Property Value

T

Methods

Arrange(IEnumerable<Widget>, Rectangle)

Arranges the child widget within the specified bounds.

public void Arrange(IEnumerable<Widget> widgets, Rectangle bounds)

Parameters

widgets IEnumerable<Widget>

The widgets to arrange (should contain the single child).

bounds Rectangle

The bounds in which to arrange the child widget.

Measure(IEnumerable<Widget>, Point)

Measures the desired size of the child widget within the given available size.

public Point Measure(IEnumerable<Widget> widgets, Point availableSize)

Parameters

widgets IEnumerable<Widget>

The widgets to measure (should contain the single child).

availableSize Point

The available size for layout.

Returns

Point

The desired size of the child widget, or zero if no child is present.