Table of Contents

Class PlacementContext

Namespace
Icy.Design.Editor.Placement
Assembly
IcyUI.Design.dll

What a placement strategy knows about a container and the element being moved or resized in it. Rectangles are in the container's local space: (0, 0) is the container's top-left corner.

public sealed class PlacementContext
Inheritance
PlacementContext
Inherited Members
Extension Methods

Constructors

PlacementContext(UIElement, UIElement, IReadOnlyList<PlacementChild>, int, Rectangle, bool, int)

Initializes a new instance of the PlacementContext class.

public PlacementContext(UIElement container, UIElement element, IReadOnlyList<PlacementChild> children, int contentCount, Rectangle elementBounds, bool isCurrentContainer, int elementIndex = -1)

Parameters

container UIElement

The container.

element UIElement

The element being placed.

children IReadOnlyList<PlacementChild>

The container's other content children that have live copies, in markup order.

contentCount int

How many content children the container has in markup, without element.

elementBounds Rectangle

The element's bounds when the gesture started, in the container's local space.

isCurrentContainer bool

Whether element is already a child of container.

elementIndex int

The element's content index in markup when isCurrentContainer is true, or -1 when it isn't known; strategies then guess it from the children's positions.

Exceptions

ArgumentNullException

An argument is null.

Properties

Children

Gets the container's other content children that have live copies, in markup order.

public IReadOnlyList<PlacementChild> Children { get; }

Property Value

IReadOnlyList<PlacementChild>

Container

Gets the container.

public UIElement Container { get; }

Property Value

UIElement

ContainerContent

Gets the area the container lays its children out in (inside its padding), in its local space.

public Rectangle ContainerContent { get; }

Property Value

Rectangle

ContentCount

Gets how many content children the container has in markup, without the element being placed.

public int ContentCount { get; }

Property Value

int

Element

Gets the element being placed.

public UIElement Element { get; }

Property Value

UIElement

ElementBounds

Gets the element's bounds when the gesture started, in the container's local space.

public Rectangle ElementBounds { get; }

Property Value

Rectangle

ElementIndex

Gets the element's content index in the container's markup, or -1 when it isn't a child of the container or the index isn't known. A move that keeps this index keeps the markup order.

public int ElementIndex { get; }

Property Value

int

IsCurrentContainer

Gets a value indicating whether the element already is one of the container's children.

public bool IsCurrentContainer { get; }

Property Value

bool

Methods

ToLocal(UIElement, Rectangle)

Converts a rectangle in layout space (an element's ActualBounds) into container's local space.

public static Rectangle ToLocal(UIElement container, Rectangle absolute)

Parameters

container UIElement

The container.

absolute Rectangle

A rectangle in the same space as the container's ActualBounds.

Returns

Rectangle

The rectangle relative to the container's top-left corner.