Skip to content

ListSelectionChangedEventArgs<T> ​

Namespace: Hex1b.Events

Assembly: Hex1b.dll

Event arguments raised when the multi-select set on a changes (Space toggles a row, Shift+Arrow extends a range, Ctrl+A selects-all, or the controlled SelectedIndices property mutates).

The cursor moving to a new row (Up/Down/Home/End/PageUp/PageDown) raises , not this event — focus and selection are independent concepts in multi-select mode.

csharp
public sealed class ListSelectionChangedEventArgs<T> : WidgetEventArgs<ListWidget<T>, ListNode<T>>

Inheritance ​

Object → WidgetEventArgs → WidgetEventArgs<ListWidget<<T>>, ListNode<<T>>> → ListSelectionChangedEventArgs<T>

Constructors ​

ListSelectionChangedEventArgs(ListWidget<T>, ListNode<T>, InputBindingActionContext, int, T?) ​

Single-select constructor — used when the cursor moves on a list that has not opted in to .MultiSelect(). Source-compatibility shim so existing OnSelectionChanged subscribers keep firing on cursor moves as they did pre-multi-select. The scalar accessors are the only valid surface on this shape.

Parameters:

csharp
public ListSelectionChangedEventArgs(ListWidget<T> widget, ListNode<T> node, InputBindingActionContext context, int cursorIndex, T? cursorItem)

ListSelectionChangedEventArgs(ListWidget<T>, ListNode<T>, InputBindingActionContext, IReadOnlyList<int>, IReadOnlyList<T>, int, T?, bool, ListSelectionChangeReason) ​

Multi-select constructor — used when the checked set changes via Toggle / ExtendRange / SelectAll / DeselectAll / Programmatic.

Parameters:

csharp
public ListSelectionChangedEventArgs(ListWidget<T> widget, ListNode<T> node, InputBindingActionContext context, IReadOnlyList<int> selectedIndices, IReadOnlyList<T> selectedItems, int toggledIndex, T? toggledItem, bool isSelected, ListSelectionChangeReason reason)

Properties ​

IsMultiSelect ​

True when this event was raised from a multi-select list (widget.MultiSelect()). When false, the event reflects a cursor move and only the scalar accessors (, , ) are valid; and friends throw.

Returns: Boolean

csharp
public bool IsMultiSelect { get; }

IsSelected ​

The new state of after the change. For this is true; for and the value reflects whether the post-change set is non-empty. In single-select (cursor) events this is always true.

Returns: Boolean

csharp
public bool IsSelected { get; }

Reason ​

What caused the selection set to change.

Returns: ListSelectionChangeReason

csharp
public ListSelectionChangeReason Reason { get; }

SelectedIndex ​

The index of the currently focused (cursor) row. Source-compatible with the pre-multi-select event shape — throws when the list is in multi-select mode (use there).

Returns: Int32

csharp
public int SelectedIndex { get; }

SelectedIndices ​

The full checked set after this change, in ascending index order. Only valid when is true; throws otherwise.

Returns: IReadOnlyList<Int32>

csharp
public IReadOnlyList<int> SelectedIndices { get; }

SelectedItem ​

The item at the currently focused (cursor) row. Source-compatible with the pre-multi-select event shape — throws when the list is in multi-select mode (use there).

Returns: <T>

csharp
public T? SelectedItem { get; }

SelectedItems ​

Materialised items for the indices in . In virtualized mode, items that are not yet loaded are skipped — always cross-reference via .Count when you need an authoritative count. Only valid when is true; throws otherwise.

Returns: IReadOnlyList<<T>>

csharp
public IReadOnlyList<T> SelectedItems { get; }

SelectedText ​

The string form of the focused (cursor) row's item (via ; empty string for null). Source-compatible with the pre-multi-select event shape — throws when the list is in multi-select mode.

Returns: String

csharp
public string SelectedText { get; }

ToggledIndex ​

The zero-based index of the row whose state just changed (multi-select) or the cursor row (single-select). In multi-select mode this is -1 when the change affected every row (, , or ).

Returns: Int32

csharp
public int ToggledIndex { get; }

ToggledItem ​

The item at , or default when is -1 or the row is not yet loaded in virtualized mode.

Returns: <T>

csharp
public T? ToggledItem { get; }

Released under the MIT License.