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
public sealed record ListWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ListWidget>

Inheritance

ObjectHex1bWidgetListWidget

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

MoveUp

Rebindable action: Move selection up.

Returns: ActionId

csharp
public static readonly ActionId MoveUp

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

Released under the MIT License.