API Reference
KeyValueList
Aligned key/value pairs: muted keys in a column sized to the longest key, values (markup) wrapping in the rest. Live operation set (Key, Text, optional State) adds or replaces a pair.
Inheritance
- LiveWidget
- KeyValueList
Usage
Explore 19 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 11
- Method Ui.KeyValue
- Extension method KeyValueList.WithGap
- Extension method KeyValueList.WithMaxKeyFraction
- Extension method KeyValueList.WithNumberColumn
- Extension method KeyValueList.WithPresentation
- Method KeyValueList.Add
- Method KeyValueList.AddValue
- Method KeyValueListFluent.WithGap
- Method KeyValueListFluent.WithMaxKeyFraction
- Method KeyValueListFluent.WithNumberColumn
- Method KeyValueListFluent.WithPresentation
Accepted by parameters 8
- Extension method KeyValueList.WithGap
- Extension method KeyValueList.WithMaxKeyFraction
- Extension method KeyValueList.WithNumberColumn
- Extension method KeyValueList.WithPresentation
- Method KeyValueListFluent.WithGap
- Method KeyValueListFluent.WithMaxKeyFraction
- Method KeyValueListFluent.WithNumberColumn
- Method KeyValueListFluent.WithPresentation
Constructors
public KeyValueList(String name = "keyvalue") #Creates a key/value list.
Parameters
- name System.String = "keyvalue"
- The live name (default keyvalue).
Methods
public KeyValueList Add(String key, String value, StatusKind? status = null) #KeyValueListAdds or replaces a pair.
Parameters
- key System.String
- The key (plain text).
- value System.String
- The value (markup).
- status ConsoleMonster.Styling.StatusKind? = null
- An optional status shown as a marker before the value.
Returns
This instance.
public KeyValueList Add(String key, Double value) #KeyValueListAdds a pair with a number formatted with thousands separators.
Parameters
- key System.String
- The key.
- value System.Double
- The number.
Returns
This instance.
public KeyValueList AddValue(String key, Object? value, ICellPresenter? presenter = null, IReadOnlyList<ToneRule>? rules = null) #KeyValueListAdds or replaces a pair whose value is formatted by a presenter (sizes, durations, dates, statuses...).
Parameters
- key System.String
- The key (plain text).
- value System.Object?
- The raw value.
- presenter ConsoleMonster.Presenters.ICellPresenter? = null
- The presenter, or null for automatic.
- rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.ToneRule>? = null
- Tone rules, or null.
Returns
This instance.
public override Void Apply(LiveEvent liveEvent) #VoidApplies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public KeyValueHandle Handle(ILiveDispatcher dispatcher) #KeyValueHandleReturns a handle that updates this list through a dispatcher (a live session).
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
Returns
The handle.
public override Size Measure(Constraints constraints, RenderContext context) #SizeReturns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Returns
The desired size, never larger than the constraints.
public override Void Render(Region region, RenderContext context) #VoidRenders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Inherited Methods
public virtual String? Describe(LiveEvent liveEvent) #String?Parameters
- liveEvent LiveEvent
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public Int32 Gap { get; set; } #Cells between the key column and the values (default 2).
public Double MaxKeyFraction { get; set; } #The widest the key column may be, as a fraction of the width (default 0.4).
public ColumnFormat NumberColumn { get; set; } #Layout of the leading number of each value (234 / 332, 8.4 rules/s, ~12s): values that start with a number share a number column, right-aligned by default, so the numbers line up under each other. Set the alignment to HorizontalAlignment.Left to print values as written.
public PresentationOptions Presentation { get; set; } #Culture, clock and time zone for values added with KeyValueList.AddValue.
Inherited Properties
Extension Methods
public static KeyValueList WithGap(KeyValueList keyValueList, Int32 value) #KeyValueListSets KeyValueList.Gap: Cells between the key column and the values (default 2).
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- value System.Int32
- The value.
Returns
The same instance.
public static KeyValueList WithMaxKeyFraction(KeyValueList keyValueList, Double value) #KeyValueListSets KeyValueList.MaxKeyFraction: The widest the key column may be, as a fraction of the width (default 0.4).
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- value System.Double
- The value.
Returns
The same instance.
public static KeyValueList WithNumberColumn(KeyValueList keyValueList, ColumnFormat value) #KeyValueListSets KeyValueList.NumberColumn: Layout of the leading number of each value (234 / 332, 8.4 rules/s, ~12s): values that start with a number share a number column, right-aligned by default, so the numbers line up under each other. Set the alignment to HorizontalAlignment.Left to print values as written.
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- value ConsoleMonster.Layout.ColumnFormat
- The value.
Returns
The same instance.
public static KeyValueList WithNumberColumn(KeyValueList keyValueList, Action<ColumnFormat> configure) #KeyValueListConfigures KeyValueList.NumberColumn in place: Layout of the leading number of each value (234 / 332, 8.4 rules/s, ~12s): values that start with a number share a number column, right-aligned by default, so the numbers line up under each other. Set the alignment to HorizontalAlignment.Left to print values as written.
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- configure System.Action<ConsoleMonster.Layout.ColumnFormat>
- Configures the value.
Returns
The same instance.
public static KeyValueList WithPresentation(KeyValueList keyValueList, PresentationOptions value) #KeyValueListSets KeyValueList.Presentation: Culture, clock and time zone for values added with KeyValueList.AddValue.
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- value ConsoleMonster.Presenters.PresentationOptions
- The value.
Returns
The same instance.
public static KeyValueList WithPresentation(KeyValueList keyValueList, Action<PresentationOptions> configure) #KeyValueListConfigures KeyValueList.Presentation in place (creating it when not set): Culture, clock and time zone for values added with KeyValueList.AddValue.
Parameters
- keyValueList ConsoleMonster.Widgets.KeyValueList
- The instance.
- configure System.Action<ConsoleMonster.Presenters.PresentationOptions>
- Configures the value.
Returns
The same instance.