ListWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Widget for displaying a selectable list of items. Selection state is owned by the node and preserved across reconciliation.
public sealed record ListWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ListWidget>Inheritance
Object → Hex1bWidget → ListWidget
Implements
Constructors
ListWidget(IReadOnlyList<string>)
Widget for displaying a selectable list of items. Selection state is owned by the node and preserved across reconciliation.
Parameters:
Items(IReadOnlyList<String>):
public ListWidget(IReadOnlyList<string> Items)Properties
InitialSelectedIndex
The initial selected index when the list is first created. Defaults to 0 (first item). Only applied when the node is new.
Returns: Int32
public int InitialSelectedIndex { get; init; }Items
Returns: IReadOnlyList<String>
public IReadOnlyList<string> Items { get; init; }Methods
OnItemActivated(Action<ListItemActivatedEventArgs>)
Sets a synchronous handler called when an item is activated (Enter, Space, or click).
Parameters:
handler(Action<ListItemActivatedEventArgs>):
Returns: ListWidget
public ListWidget OnItemActivated(Action<ListItemActivatedEventArgs> handler)OnItemActivated(Func<ListItemActivatedEventArgs, Task>)
Sets an asynchronous handler called when an item is activated (Enter, Space, or click).
Parameters:
handler(Func<ListItemActivatedEventArgs, Task>):
Returns: ListWidget
public ListWidget OnItemActivated(Func<ListItemActivatedEventArgs, Task> handler)OnSelectionChanged(Action<ListSelectionChangedEventArgs>)
Sets a synchronous handler called when the selection changes.
Parameters:
handler(Action<ListSelectionChangedEventArgs>):
Returns: ListWidget
public ListWidget OnSelectionChanged(Action<ListSelectionChangedEventArgs> handler)OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task>)
Sets an asynchronous handler called when the selection changes.
Parameters:
handler(Func<ListSelectionChangedEventArgs, Task>):
Returns: ListWidget
public ListWidget OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task> handler)Fields
Activate
Rebindable action: Activate the selected item.
Returns: ActionId
public static readonly ActionId ActivateMoveDown
Rebindable action: Move selection down.
Returns: ActionId
public static readonly ActionId MoveDownMoveUp
Rebindable action: Move selection up.
Returns: ActionId
public static readonly ActionId MoveUpScrollDown
Rebindable action: Scroll down.
Returns: ActionId
public static readonly ActionId ScrollDownScrollUp
Rebindable action: Scroll up.
Returns: ActionId
public static readonly ActionId ScrollUp