Vixen
dd8b0a81
csharp
public sealed class GradientRail

The rail of markers above or below the bar.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ The keyboard came before the role, which is #420's whole ordering. This was pointer-only and roleless together, and the pairing was deliberate: announcing a rail a mouse alone can reach converts "not available to me" into "available and does nothing". So the arrows landed with the role, in one change, and neither is correct alone.

⚠ Two axes and two meanings, because a rail is a list and not a value. Left and Right move the selected stop along the gradient — a hundredth a press, a tenth with Page, the ends with Home and End, which is ColorStrip's contract. Up and Down select the previous and next stop, which on a horizontal rail is an axis with nothing else to mean. Any of the six with nothing selected selects the first stop rather than doing nothing: a keyboard user who has just tabbed in has no selection and would otherwise be stuck in a control that answers no key.

⚠ One tab stop for the whole rail, not one per stop. A stop is drawn rather than built — see GradientRail.OnDraw — so there is no element to focus, and a gradient of sixteen stops would otherwise be sixteen tab stops between the bar and the picker.

Fields and properties (11)

  • public const float KeyStep

    How far one arrow press moves the selected stop. ColorStrip.KeyStep's value.

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • protected override AccessibleRole NativeRole
  • protected override string? NativeAccessibleName
  • protected override string? NativeAccessibleValue
  • public GradientEditor? Owner

    The editor it belongs to.

  • public bool IsAlpha

    Whether it carries the alpha stops rather than the colour ones.

  • public int Count

    How many stops this rail carries.

  • public int SelectedIndex

    Where the selected stop is on this rail, or -1 when none of them is.

  • public float SelectedPosition

    Where the selected stop sits along the gradient, or zero when none is selected.

Methods (4)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public void SelectAt(int index)

    Selects the stop at an index of this rail's list, or nothing for an index outside it.

  • public void MoveSelected(float position)

    Moves the selected stop to a position along the gradient.

  • protected override void OnDraw(DrawContext context)

    Draws whatever this element is, beyond what a stylesheet can describe.

Used by (2)

  • GradientEditorVixen.Ui.Controls.Advanced
  • GradientRailKeyboardTestsVixen.Ui.Controls.Advanced.Tests