Class PlacementContext
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
containerUIElementThe container.
elementUIElementThe element being placed.
childrenIReadOnlyList<PlacementChild>The container's other content children that have live copies, in markup order.
contentCountintHow many content children the container has in markup, without
element.elementBoundsRectangleThe element's bounds when the gesture started, in the container's local space.
isCurrentContainerboolWhether
elementis already a child ofcontainer.elementIndexintThe element's content index in markup when
isCurrentContaineris true, or-1when 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
Container
Gets the container.
public UIElement Container { get; }
Property Value
ContainerContent
Gets the area the container lays its children out in (inside its padding), in its local space.
public Rectangle ContainerContent { get; }
Property Value
ContentCount
Gets how many content children the container has in markup, without the element being placed.
public int ContentCount { get; }
Property Value
Element
Gets the element being placed.
public UIElement Element { get; }
Property Value
ElementBounds
Gets the element's bounds when the gesture started, in the container's local space.
public Rectangle ElementBounds { get; }
Property Value
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
IsCurrentContainer
Gets a value indicating whether the element already is one of the container's children.
public bool IsCurrentContainer { get; }
Property Value
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
containerUIElementThe container.
absoluteRectangleA rectangle in the same space as the container's ActualBounds.
Returns
- Rectangle
The rectangle relative to the container's top-left corner.