Chip class Core
One row that stands for a field or an item: an optional drag grip, a leading TypeBadge or icon, its caption, and at the end a status pill, a marker dot or a gradient swatch - and, while it is hovered or holds the focus, small icon buttons for its actions (ChipAction), which are in the accessibility tree whether shown or not. A click, Enter and Space run Chip.Click; the right button and Shift+F10 open its Control.ContextMenu. With a Chip.DragPayload the chip can be picked up and dragged (ControlHost.BeginDrag) once the pointer moved four units away from the press; in a DropList that is how it moves between lists.
Styling. From the style sheets (Select.Type<Chip>()): background, border (solid or dashed), corner radius, shadow, the caption's colour, size, weight and family, the opacity and the focus ring, in every state; a chip that is Chip.Selected is in TileStates.Checked. The theme's look is a list row (32 units, rounded by 7, tinted while hovered, no border); the class card makes it a card (34 units, card fill, hairline border, rounded by 8). Selected, both take the accent's border and a soft shadow. The action buttons are Buttons with the class chip-action (and accent); the status pill is a TypeBadge of TypeBadgeKind.Accent with the class pill; the marker dot takes the style's accent colour.
public sealed class Chip : Panel
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Panel
Constructors
Chip
public Chip();
Properties
Actions
public IReadOnlyList<ChipAction> Actions { get; init; }The actions offered as icon buttons while the chip is hovered or focused.
Badge
public TypeBadge? Badge { get; init; }A badge before the caption (the kind of field); null for none.
Click
public Action? Click { get; init; }A click, Enter, Space or assistive technology's invoke; null for none.
DragGroup
public string? DragGroup { get; init; }The group a drag of this chip belongs to; null takes the group of the DropList the chip is in.
DragPayload
public object? DragPayload { get; init; }What the chip carries when it is dragged; null: it cannot be dragged.
DrawsOwnFocus
public override bool DrawsOwnFocus { get; }
Focusable
public override bool Focusable { get; }
Height
public double Height { get; init; }The height the chip asks for; NaN (the default) takes 34 for the class card, 32 otherwise.
HitsSelf
protected override bool HitsSelf { get; }Whether a press where no child answers lands on the panel itself (a list that takes drops, a chip); false: the panel is transparent there.
Icon
public Action<IRenderSurface, LogRect, Rgba>? Icon { get; init; }An icon before the caption when there is no Chip.Badge, drawn in the dim text colour; null for none.
Marked
public Func<bool>? Marked { get; init; }Whether the marker dot shows at the end (a filter is set); null for never.
Role
public override ControlRole Role { get; }
Selected
public Func<bool>? Selected { get; init; }Whether the chip is selected (highlighted); null for never.
ShowsGrip
public bool ShowsGrip { get; init; }Shows the drag grip (two columns of dots) at the start.
Spoken
public Func<string>? Spoken { get; init; }What a reader says for the chip; default: the caption and the status.
Status
public Func<string?>? Status { get; init; }A short status shown as a pill at the end ("Rows"); null or empty for none.
SwatchFrom
public Func<Rgba>? SwatchFrom { get; init; }The start colour of the small gradient swatch at the end (a heatmap's scale); shown together with Chip.SwatchTo unless both are transparent.
SwatchTo
public Func<Rgba>? SwatchTo { get; init; }The end colour of the gradient swatch.
TakesHoverOfParts
protected internal override bool TakesHoverOfParts { get; }The chip stays hovered while the pointer is on one of its action buttons.
Text
public required Func<string> Text { get; init; }The caption, asked each time it is drawn.
ToggleState
public override bool? ToggleState { get; }
Methods
Arrange
public override void Arrange(LogRect bounds);
EnsureChildren
protected override void EnsureChildren();The badge, the status pill and the action buttons, built once from what the chip was made with.
HitsChild
protected override bool HitsChild(Control child);Of its parts only the action buttons answer presses; the rest is the chip's.
Invoke
public override bool Invoke();
Measure
public override LogSize Measure(LogSize available);
MenuEntries
public IReadOnlyList<MenuItem> MenuEntries();What the chip's context menu offers, for a menu opened another way (its "more" action): its own entries and, in a DropList, the "Move to" entries.
OnActivate
protected internal override void OnActivate();
OnKey
public override bool OnKey(ArionKey key, ArionModifiers mods);
OnPointerMoved
public override void OnPointerMoved(LogPoint p, bool buttonDown);
Render
public override void Render(IRenderSurface s, ControlFrame frame);
ShowsChild
protected override bool ShowsChild(Control child);The action buttons take part while they show; the badge and the pill whenever they are visible (the pill hides itself while the actions show).
SpokenLabel
public override string? SpokenLabel();