DropList class Core
A zone holding Chips one under the other that takes dragged chips: reordered within it, moved in from other lists of the same DropList.Group, refused where DropList.Accepts says no or where the list they come from must keep its last item (DropList.KeepsOne). While a drag is over it the zone is ringed in the accent and an accent line shows where the chip would land - at the end for a drop in the gap under the last chip; a drag of its group it refuses rings it in a dashed red, and the reason (DropList.RefusedHintFor) stands beside the pointer (DragData.Refusal). Empty, it shows a dashed placeholder ("Drop a field here"). Up and Down move the focus between the chips, Alt+Up and Alt+Down move the focused chip within the list; Ctrl+Shift+Left and Ctrl+Shift+Right move it to the previous or the next list of the same group in the host, and a chip's context menu offers "Move to" each other list of the group that has a caption (its DropList.Header). Every move is a request to the owner (DropList.Moved), who rebuilds the items.
Styling. From the style sheets (Select.Type<DropList>()): the zone's box (background, border, corner radius, shadow), its padding and the accent colour of the insertion line; :checked styles the zone while a drag over it would land, :invalid while it refuses one. The theme draws the zone fill rounded by 10 with 10 units of padding. The placeholder carries the class drop-placeholder (Select.Class("drop-placeholder")): a dashed border in Tokens.DashBorder rounded by 8 with the faint text, the accent's tint and border while a drag would land on it; with DropList.PlaceholderIsHint it also carries drop-hint, which the theme draws as plain faint text.
public sealed class DropList : Panel, IDropTarget
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Panel
- Implements
- IDropTarget
Constructors
DropList
public DropList();
Properties
Accepts
public Func<DragData, bool>? Accepts { get; init; }Whether the list takes a drag (a values zone takes measures only); null: it takes every drag of its group.
Gap
public double Gap { get; init; }Space between two chips, and between the header and the first.
Group
public string? Group { get; init; }Drags of this group only are taken (DragData.Group); chips in the list carry it when they set none of their own. Null takes drags without a group.
Header
public SectionHeader? Header { get; init; }A header above the chips (the zone's name); null for none.
HitsSelf
protected override bool HitsSelf { get; }The list takes the presses its chips leave - a drop in its padding lands on it.
InsertionIndex
public int InsertionIndex { get; }Where a drag over the list would land (an index into DropList.Items); -1 while no drag is over it.
Items
public IReadOnlyList<Chip> Items { get; }The chips, in order.
KeepsOne
public bool KeepsOne { get; init; }The list keeps its last chip: no other list takes it away.
Moved
public Action<DropMove>? Moved { get; init; }Asked to make a move (a drop, Alt+Up or Alt+Down); null for none.
Placeholder
public LocalText Placeholder { get; init; }The text of the empty list's placeholder.
PlaceholderIsHint
public bool PlaceholderIsHint { get; init; }The empty list shows its DropList.Placeholder as a plain hint (class drop-hint) instead of the dashed box that invites a drop - a list that takes no drags.
RefusedHint
public Func<string>? RefusedHint { get; init; }Said once per drag when a drag of the list's DropList.Group comes over it and is refused (why it takes nothing, where it comes from instead); null says nothing.
RefusedHintFor
public Func<DragData, string?>? RefusedHintFor { get; init; }Like DropList.RefusedHint, told which drag was refused, for a list that refuses for more than one reason; null from it says nothing. Set, it takes the place of DropList.RefusedHint.
Role
public override ControlRole Role { get; }
Methods
Arrange
public override void Arrange(LogRect bounds);
DragLeave
public void DragLeave(DragData data);The drag left this target or ended elsewhere: take the feedback away.
DragOver
public bool DragOver(DragData data, LogPoint p);The drag is over this target at p: true when it would take it there (and shows where), false when it refuses.
Drop
public void Drop(DragData data, LogPoint p);The drag was released over this target at p, which accepted it.
EnsureChildren
protected override void EnsureChildren();The header, the chips and the placeholder, in that order.
HitsChild
protected override bool HitsChild(Control child);Only the chips answer presses; header and placeholder belong to the list.
Measure
public override LogSize Measure(LogSize available);
RenderFace
protected override void RenderFace(IRenderSurface s, ControlFrame frame);What the panel draws under its children: its box, its own parts. Nothing by default.
RenderOver
protected override void RenderOver(IRenderSurface s, ControlFrame frame);The insertion line, over the chips.
SetItems
public void SetItems(IEnumerable<Chip> chips);Gives the list its chips, replacing those it held. On a shown board call it inside Board.Mutate.
WouldTake
public bool WouldTake(DragData data);Whether the target would take data somewhere, asked without a place and without showing anything: a scrolling panel around it scrolls for a drag only then, and a target near the pointer is offered the drag only then. True by default.