Vixen
dd8b0a81
csharp
public sealed class KeyValueList

A column of key/value rows: equal halves, alternating shades, one row per fact.

Read the guide page for this →

Remarks

The editor grew five of these by hand — a frame debugger's state pane, a memory panel, a statistics panel, a build analysis and a compositor's settings — and every one of them reimplemented the same pooling loop, the same two-element row and a slightly different set of column widths. This is that shape, once, with the parts named so a stylesheet can reach them and the rows addressable from a .vxml.

⚠ Not PropertyGrid generalised, and the reason is what a PropertyRow is. That row carries a MemberDescriptor, the path through the boxes that reaches it, a nesting depth and a reset button — it is a view of a member of an object, and its whole value is that the grid builds it by asking a type about itself. Nothing here has a type to ask. Stripping a property row down until it fitted a memory panel's byte counts would leave two columns and a class, which is this, and would leave the inspector's row in an assembly that cannot depend on Vixen.Core.Reflection. The two share a stylesheet's worth of ideas and no code.

⚠ Rows are direct children, which is a constraint rather than a convenience. The stripe is key-value-row:nth-child(even), so anything else parented here — a heading built out of a div, an empty-state, a separator — takes a position in the alternation and shifts every row after it. The cascade is what re-resolves the stripe when a row is inserted or removed in the middle, and it does that for free; a class applied when the row was built would be stale from the first mutation, which is the bug this choice exists to avoid. A caller with something else to show puts it beside the list, not in it.

The halves are equal by flex-basis: 0 and min-width: 0 together. Either alone is not enough: a flex item's automatic minimum size is its content, so a long unbreakable key with only the basis set measures its whole string and overhangs the value column — 388 pixels into a 200-pixel row, in the test that says so.

Fields and properties (4)

  • 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.

  • public IReadOnlyList<KeyValueRow> Rows

    The rows, in order, including any this list is holding parked.

  • public int Count

    How many rows are showing.

Methods (4)

  • public KeyValueRow AddRow(string? key = null, string? value = null)

    Adds a row at the end.

  • public KeyValueRow Row(int index)

    The row at an index, making it and everything before it if they do not exist yet.

  • public void Trim(int count)

    Hides every row from an index on, keeping them for the next time.

  • public void Clear()

    Takes every row out, pool and all.

Used by (11)

  • AccessibilityTreeTestsVixen.Ui.Controls.Tests
  • DiagnosticsPanelVixen.Ui.Controls
  • DiagnosticsPanelTestsVixen.Ui.Controls.Tests
  • FactSheetVixen.Ui.Controls.Tests
  • HarnessVixen.Ui.Controls.Tests
  • KeyValueListTestsVixen.Ui.Controls.Tests
  • CompositorSettingsTestsVixen.Editor.AssetEditors.Tests
  • CompositorViewVixen.Editor.AssetEditors
  • FrameDebuggerViewVixen.Editor.Debugger
  • NetworkViewVixen.Editor.Debugger
  • UiDiagnosticsPanelTestsVixen.Editor.App.Tests