Skip to content

ListExtensions

Namespace: Hex1b

Assembly: Hex1b.dll

Extension methods for building and configuring .

csharp
public static class ListExtensions

Inheritance

ObjectListExtensions

Methods

FocusedIndex<T>(ListWidget<T>, int)

Drives the list's focused (cursor) index on every reconciliation. Use this when the cursor lives in an owning composite's state (e.g. a search-filtered selection prompt where a focused textbox forwards Up/Down to the list).

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> FocusedIndex<T>(this ListWidget<T> widget, int index)

InitialFocusedIndex<T>(ListWidget<T>, int)

Sets the index that should be focused (cursor row) when the list is first created. Ignored on subsequent reconciliations.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> InitialFocusedIndex<T>(this ListWidget<T> widget, int index)

InitialSelectedIndices<T>(ListWidget<T>, IReadOnlyList<int>)

Seeds the multi-select checked set when the list is first created (uncontrolled mode). Has no effect once the node already exists; use for controlled state.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> InitialSelectedIndices<T>(this ListWidget<T> widget, IReadOnlyList<int> indices)

ItemHeight<T>(ListWidget<T>, int)

Sets the fixed row height (in terminal rows) used for every item. Defaults to 1. Values below 1 are clamped to 1.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> ItemHeight<T>(this ListWidget<T> widget, int rows)

ItemKey<T>(ListWidget<T>, Func<T, object>)

Sets a key selector so reused per-row template subtrees follow items by identity even after reorder or filter.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> ItemKey<T>(this ListWidget<T> widget, Func<T, object> keySelector)

ItemTemplate<T>(ListWidget<T>, Func<ListItemContext<T>, Hex1bWidget>)

Sets the per-row template used to render each item. The list itself stops drawing the selector and selected/hover background — the template owns all row chrome and styles itself from .

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> ItemTemplate<T>(this ListWidget<T> widget, Func<ListItemContext<T>, Hex1bWidget> builder)

List<T>(RootContext, IListDataSource<T>)

Creates a virtualized typed list bound to an . The node fetches only a window of items around the visible viewport on each frame and re-fetches when the user scrolls or the source raises .

Parameters:

  • context (RootContext):
  • dataSource (IListDataSource<<T>>):

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> List<T>(this RootContext context, IListDataSource<T> dataSource)

List<T>(RootContext, IReadOnlyList<T>?)

Creates a typed list bound to items. Pass null to construct an empty list (useful when a parent composite is still resolving its data or when you'll supply items later by using the overload). Use to render each row as a custom widget tree.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> List<T>(this RootContext context, IReadOnlyList<T>? items)

List<TParent, T>(WidgetContext<TParent>, IListDataSource<T>)

Creates a virtualized typed list bound to an . See the overload for details.

Parameters:

  • context (WidgetContext<<TParent>>):
  • dataSource (IListDataSource<<T>>):

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> List<TParent, T>(this WidgetContext<TParent> context, IListDataSource<T> dataSource) where TParent : Hex1bWidget

List<TParent, T>(WidgetContext<TParent>, IReadOnlyList<T>?)

Creates a typed list bound to items. Pass null to construct an empty list. Use to render each row as a custom widget tree.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> List<TParent, T>(this WidgetContext<TParent> context, IReadOnlyList<T>? items) where TParent : Hex1bWidget

MultiSelect<T>(ListWidget<T>)

Enables multi-select on this list. While enabled, Space toggles the focused row, Shift+Up/Down/Home/End extend a range from the anchor, and Ctrl+A selects (or deselects) all rows. The current checked set is surfaced through for custom templates; the built-in renderer additionally draws a checkbox glyph in front of each row.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> MultiSelect<T>(this ListWidget<T> widget)

OnFocusChanged<T>(ListWidget<T>, Action<ListFocusChangedEventArgs<T>>)

Sets a synchronous handler invoked when the focused (cursor) row changes.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnFocusChanged<T>(this ListWidget<T> widget, Action<ListFocusChangedEventArgs<T>> handler)

OnFocusChanged<T>(ListWidget<T>, Func<ListFocusChangedEventArgs<T>, Task>)

Sets an asynchronous handler invoked when the focused (cursor) row changes.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnFocusChanged<T>(this ListWidget<T> widget, Func<ListFocusChangedEventArgs<T>, Task> handler)

OnItemActivated<T>(ListWidget<T>, Action<ListItemActivatedEventArgs<T>>)

Sets a synchronous handler invoked when an item is activated (Enter, Space, or click).

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnItemActivated<T>(this ListWidget<T> widget, Action<ListItemActivatedEventArgs<T>> handler)

OnItemActivated<T>(ListWidget<T>, Func<ListItemActivatedEventArgs<T>, Task>)

Sets an asynchronous handler invoked when an item is activated (Enter, Space, or click).

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnItemActivated<T>(this ListWidget<T> widget, Func<ListItemActivatedEventArgs<T>, Task> handler)

OnSelectionChanged<T>(ListWidget<T>, Action<ListSelectionChangedEventArgs<T>>)

Sets a synchronous handler invoked when the multi-select checked set changes (toggle, range extend, or select-all). The event args expose the full SelectedIndices/SelectedItems after the change, the index whose state just flipped, and a distinguishing the trigger.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnSelectionChanged<T>(this ListWidget<T> widget, Action<ListSelectionChangedEventArgs<T>> handler)

OnSelectionChanged<T>(ListWidget<T>, Func<ListSelectionChangedEventArgs<T>, Task>)

Sets an asynchronous handler invoked when the multi-select checked set changes.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> OnSelectionChanged<T>(this ListWidget<T> widget, Func<ListSelectionChangedEventArgs<T>, Task> handler)

SelectedIndices<T>(ListWidget<T>, IReadOnlyList<int>)

Drives the multi-select checked set on every reconciliation (controlled mode). The owning composite should hold this collection in its own state and replace it inside . Indices outside the current item range are silently dropped.

Parameters:

Returns: ListWidget<<T>>

csharp
public static ListWidget<T> SelectedIndices<T>(this ListWidget<T> widget, IReadOnlyList<int> indices)

Released under the MIT License.