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.
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:
Items(IReadOnlyList<TreeItemWidget>): The root tree items to display.
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
public bool IsMultiSelect { get; init; }Items
The root tree items to display.
Returns: IReadOnlyList<TreeItemWidget>
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:
enabled(Boolean):
Returns: TreeWidget
public TreeWidget MultiSelect(bool enabled = true)OnItemActivated(Action<TreeItemActivatedEventArgs>)
Sets a synchronous handler called when an item is activated (Enter key).
Parameters:
handler(Action<TreeItemActivatedEventArgs>):
Returns: TreeWidget
public TreeWidget OnItemActivated(Action<TreeItemActivatedEventArgs> handler)OnItemActivated(Func<TreeItemActivatedEventArgs, Task>)
Sets an asynchronous handler called when an item is activated (Enter key).
Parameters:
handler(Func<TreeItemActivatedEventArgs, Task>):
Returns: TreeWidget
public TreeWidget OnItemActivated(Func<TreeItemActivatedEventArgs, Task> handler)OnSelectionChanged(Action<TreeSelectionChangedEventArgs>)
Sets a synchronous handler called when the selection changes (in multi-select mode).
Parameters:
handler(Action<TreeSelectionChangedEventArgs>):
Returns: TreeWidget
public TreeWidget OnSelectionChanged(Action<TreeSelectionChangedEventArgs> handler)OnSelectionChanged(Func<TreeSelectionChangedEventArgs, Task>)
Sets an asynchronous handler called when the selection changes (in multi-select mode).
Parameters:
handler(Func<TreeSelectionChangedEventArgs, Task>):
Returns: TreeWidget
public TreeWidget OnSelectionChanged(Func<TreeSelectionChangedEventArgs, Task> handler)Fields
ActivateActionId
Action ID for activating the focused item.
Returns: ActionId
public static readonly ActionId ActivateActionIdCollapseOrParentActionId
Action ID for collapsing or moving to parent.
Returns: ActionId
public static readonly ActionId CollapseOrParentActionIdDoubleClickActivateActionId
Action ID for activating an item via mouse double-click.
Returns: ActionId
public static readonly ActionId DoubleClickActivateActionIdExpandOrChildActionId
Action ID for expanding or moving to child.
Returns: ActionId
public static readonly ActionId ExpandOrChildActionIdMoveDownActionId
Action ID for moving focus down in the tree.
Returns: ActionId
public static readonly ActionId MoveDownActionIdMoveUpActionId
Action ID for moving focus up in the tree.
Returns: ActionId
public static readonly ActionId MoveUpActionIdSelectItemActionId
Action ID for selecting an item via mouse click.
Returns: ActionId
public static readonly ActionId SelectItemActionIdToggleActionId
Action ID for toggling selection or expand state.
Returns: ActionId
public static readonly ActionId ToggleActionId