Skip to content

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.

csharp
[Obsolete("ListWidget is deprecated. Use ListWidget<T> instead — context.List(items) now returns ListWidget<string>. The non-generic ListWidget is retained for back-compat and will be removed in a future release.", DiagnosticId = "HEX1B0100", UrlFormat = "https://github.com/mitchdenny/hex1b/blob/main/docs/diagnostics/{0}.md")]
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:

csharp
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

csharp
public int InitialSelectedIndex { get; init; }

Items ​

Returns: IReadOnlyList<String>

csharp
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:

Returns: ListWidget

csharp
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:

Returns: ListWidget

csharp
public ListWidget OnItemActivated(Func<ListItemActivatedEventArgs, Task> handler)

OnSelectionChanged(Action<ListSelectionChangedEventArgs>) ​

Sets a synchronous handler called when the selection changes.

Parameters:

Returns: ListWidget

csharp
public ListWidget OnSelectionChanged(Action<ListSelectionChangedEventArgs> handler)

OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task>) ​

Sets an asynchronous handler called when the selection changes.

Parameters:

Returns: ListWidget

csharp
public ListWidget OnSelectionChanged(Func<ListSelectionChangedEventArgs, Task> handler)

Fields ​

Activate ​

Rebindable action: Activate the selected item.

Returns: ActionId

csharp
public static readonly ActionId Activate

MoveDown ​

Rebindable action: Move selection down.

Returns: ActionId

csharp
public static readonly ActionId MoveDown

MoveToFirst ​

Rebindable action: Move selection to the first item.

Returns: ActionId

csharp
public static readonly ActionId MoveToFirst

MoveToLast ​

Rebindable action: Move selection to the last item.

Returns: ActionId

csharp
public static readonly ActionId MoveToLast

MoveUp ​

Rebindable action: Move selection up.

Returns: ActionId

csharp
public static readonly ActionId MoveUp

PageDown ​

Rebindable action: Move selection down by one viewport.

Returns: ActionId

csharp
public static readonly ActionId PageDown

PageUp ​

Rebindable action: Move selection up by one viewport.

Returns: ActionId

csharp
public static readonly ActionId PageUp

ScrollDown ​

Rebindable action: Scroll down.

Returns: ActionId

csharp
public static readonly ActionId ScrollDown

ScrollUp ​

Rebindable action: Scroll up.

Returns: ActionId

csharp
public static readonly ActionId ScrollUp

Remarks ​

This non-generic widget is preserved for back-compat with existing code that rebinds / / action ids or constructs new ListWidget(items) directly. New code should prefer , which supports custom per-row templates and typed event args. The context.List(items) extension now returns of .

Released under the MIT License.