Class MarginPlacement
The fallback placement: an element moves by its margin, alignment-aware, and resizes by its size (or, on a stretched axis, by the margin on the dragged side). Used for any container without a registered strategy.
public class MarginPlacement : IPlacementStrategy
- Inheritance
-
MarginPlacement
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
A container whose markup content is a single slot (a Border's child, a ContentControl's content)
accepts a dropped element only when the slot is empty.
Properties
OwnedAttributes
Gets the attributes that only mean something inside this kind of container, such as Grid.Row. They're
removed from an element that moves into a different container.
public virtual IReadOnlyList<string> OwnedAttributes { get; }
Property Value
Methods
AcceptsDrop(PlacementContext)
Decides whether the container can take a dropped element at all.
protected virtual bool AcceptsDrop(PlacementContext context)
Parameters
contextPlacementContextThe container and the dragged element.
Returns
- bool
true for list containers and for an empty single slot; false for a filled single slot that doesn't already hold the element.
BeginResize(PlacementContext, ResizeHandle)
Starts resizing an element of this container from handle.
public virtual IResizeOperation BeginResize(PlacementContext context, ResizeHandle handle)
Parameters
contextPlacementContextThe container and the element, as they were when the gesture started.
handleResizeHandleThe dragged handle.
Returns
- IResizeOperation
The operation to update while the pointer moves.
CurrentIndex(PlacementContext)
Gets the element's current content index, so a move inside the same container keeps its order.
protected static int CurrentIndex(PlacementContext context)
Parameters
contextPlacementContextThe container and the element.
Returns
- int
The index MoveElement(NodeId, NodeId, int) would leave unchanged.
GetDropTarget(PlacementContext, Vector2)
Decides where an element dropped at point lands.
public virtual PlacementTarget? GetDropTarget(PlacementContext context, Vector2 point)
Parameters
contextPlacementContextThe container and the dragged element.
pointVector2Where the dragged element's top-left corner would be, in the container's local space.
Returns
- PlacementTarget
The target, or null when the container can't take the element.