Skip to content

TreeWidget ​

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

Container widget that displays hierarchical data in a tree structure with guides and indentation. Supports keyboard navigation, expand/collapse, and multi-selection.

csharp
public sealed record TreeWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<TreeWidget>

Inheritance ​

Object → Hex1bWidget → TreeWidget

Implements ​

Constructors ​

TreeWidget(IReadOnlyList<TreeItemWidget>) ​

Container widget that displays hierarchical data in a tree structure with guides and indentation. Supports keyboard navigation, expand/collapse, and multi-selection.

Parameters:

csharp
public TreeWidget(IReadOnlyList<TreeItemWidget> Items)

Properties ​

IsMultiSelect ​

Whether multiple items can be selected with checkboxes. Default is false. When enabled, selecting a parent automatically selects all children (cascade selection).

Returns: Boolean

csharp
public bool IsMultiSelect { get; init; }

Items ​

The root tree items to display.

Returns: IReadOnlyList<TreeItemWidget>

csharp
public IReadOnlyList<TreeItemWidget> Items { get; init; }

Methods ​

MultiSelect(bool) ​

Enables multi-select mode with checkboxes and cascade selection. Selecting a parent automatically selects all children, and partial child selection shows an indeterminate state on the parent.

Parameters:

Returns: TreeWidget

csharp
public TreeWidget MultiSelect(bool enabled = true)

OnItemActivated(Action<TreeItemActivatedEventArgs>) ​

Sets a synchronous handler called when an item is activated (Enter key).

Parameters:

Returns: TreeWidget

csharp
public TreeWidget OnItemActivated(Action<TreeItemActivatedEventArgs> handler)

OnItemActivated(Func<TreeItemActivatedEventArgs, Task>) ​

Sets an asynchronous handler called when an item is activated (Enter key).

Parameters:

Returns: TreeWidget

csharp
public TreeWidget OnItemActivated(Func<TreeItemActivatedEventArgs, Task> handler)

OnSelectionChanged(Action<TreeSelectionChangedEventArgs>) ​

Sets a synchronous handler called when the selection changes (in multi-select mode).

Parameters:

Returns: TreeWidget

csharp
public TreeWidget OnSelectionChanged(Action<TreeSelectionChangedEventArgs> handler)

OnSelectionChanged(Func<TreeSelectionChangedEventArgs, Task>) ​

Sets an asynchronous handler called when the selection changes (in multi-select mode).

Parameters:

Returns: TreeWidget

csharp
public TreeWidget OnSelectionChanged(Func<TreeSelectionChangedEventArgs, Task> handler)

Fields ​

ActivateActionId ​

Action ID for activating the focused item.

Returns: ActionId

csharp
public static readonly ActionId ActivateActionId

CollapseOrParentActionId ​

Action ID for collapsing or moving to parent.

Returns: ActionId

csharp
public static readonly ActionId CollapseOrParentActionId

DoubleClickActivateActionId ​

Action ID for activating an item via mouse double-click.

Returns: ActionId

csharp
public static readonly ActionId DoubleClickActivateActionId

ExpandOrChildActionId ​

Action ID for expanding or moving to child.

Returns: ActionId

csharp
public static readonly ActionId ExpandOrChildActionId

MoveDownActionId ​

Action ID for moving focus down in the tree.

Returns: ActionId

csharp
public static readonly ActionId MoveDownActionId

MoveUpActionId ​

Action ID for moving focus up in the tree.

Returns: ActionId

csharp
public static readonly ActionId MoveUpActionId

SelectItemActionId ​

Action ID for selecting an item via mouse click.

Returns: ActionId

csharp
public static readonly ActionId SelectItemActionId

ToggleActionId ​

Action ID for toggling selection or expand state.

Returns: ActionId

csharp
public static readonly ActionId ToggleActionId

Released under the MIT License.