Tree
A tree on the file list's model, over a flat keyed list of nodes in walking order.
new TreeComponent("tree")
Properties
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
| Own | ||||
BorderThicknessSetBorderThickness · BindBorderThickness | UIThickness? | 0 | one-way | The border thickness; a tree is a list in a panel and draws no edge of its own by default. |
IndentSetIndent · BindIndent | double? | 16 | one-way | How far each level steps in from the one above, in pixels. |
RenamableSetRenamable · BindRenamable | bool? | false | one-way | Whether a node's title can be renamed in place: F2, or a RenameNodeEffect from a menu. |
RenameOnDoubleClickSetRenameOnDoubleClick · BindRenameOnDoubleClick | bool? | false | one-way | Whether a double click renames the node rather than opening it; Enter opens either way. |
DraggableSetDraggable · BindDraggable | bool? | false | one-way | Whether a node can be dragged onto another: the drop writes the node's DropTarget and raises move, and the controller moves the node or leaves it — nothing moves on the client. |
RemovableSetRemovable · BindRemovable | bool? | true | one-way | Whether the Delete key raises remove on the keyboard's node at all; a single node refuses it with the item's CanRemove. |
ShowFoldChevronSetShowFoldChevron · BindShowFoldChevron | bool? | true | one-way | Whether a node that can unfold draws its chevron; off, the rows keep no square for one and fold from the keyboard or from a click on a node that refuses the choice. |
RowHoverableSetRowHoverable · BindRowHoverable | bool? | true | one-way | Whether rows highlight under the pointer — on by default, as a file list's are. |
BorderColorSetBorderColor · BindBorderColor | UIThemeColor? | null | one-way | The border's colour, written as CSS border-color; unset leaves the stylesheet's own. |
BorderRadiusSetBorderRadius · BindBorderRadius | UICornerRadius? | null | one-way | The corner rounding, written as CSS border-radius; unset leaves the stylesheet's own. |
SurfaceSetSurface · BindSurface | UISurfaceStyle? | UISurfaceStyle.Background | one-way | What the component is made of. |
HorizontalScrollSetHorizontalScroll · BindHorizontalScroll | UIScrollMode? | UIScrollMode.Disabled | one-way | Whether the viewport scrolls horizontally — Disabled, Auto, or Always; default Disabled. |
VerticalScrollSetVerticalScroll · BindVerticalScroll | UIScrollMode? | UIScrollMode.Auto | one-way | Whether the viewport scrolls vertically — Disabled, Auto, or Always; default Auto. |
ScrollSnapSetScrollSnap · BindScrollSnap | UIScrollSnapMode? | UIScrollSnapMode.Disabled | one-way | Whether a scroll comes to rest on a child's edge rather than wherever it was let go. |
ScrollAnchorSetScrollAnchor · BindScrollAnchor | UIScrollAnchor? | UIScrollAnchor.None | one-way | How the viewport reacts when its content grows, applying to the component's own scrolling element so it also works for a windowed host that a wrapping ScrollContainer could not reach. |
SelectionModeSetSelectionMode · BindSelectionMode | UISelectionMode? | UISelectionMode.None | one-way | How many rows may be chosen at once. |
SelectedKeySetSelectedKey · BindSelectedKey | string | null | two-way | The key of the chosen row under UISelectionMode.One. |
SelectedKeysSetSelectedKeys · BindSelectedKeys | IReadOnlyList<string> | null | two-way | The keys of the chosen rows under UISelectionMode.Many, in the order they were chosen. |
SelectionStyleSetSelectionStyle · BindSelectionStyle | UISelectionStyle? | null | one-way | What a chosen item looks like. Unset, and every unset part of it, is the control's own default. |
| From ItemsComponentBase | ||||
ItemsSetItems · BindItems | IReadOnlyList<ITreeNodeModel> | null | one-way | The component items. |
ItemsViewBindItemsView | UIItemsView | null | one-way | Filtering and sorting rules applied to the items collection. |
QuerySetQuery · BindQuery | UIItemsQuery | null | two-way | The terms the viewer set after the view compiled — a header's sort, a filter row — applied beside the authored rules; bound both ways, so a windowed source is asked with them and a controller can set them. |
| From TemplatedComponentBase | ||||
TemplateKeyPropertySetTemplateKeyProperty · BindTemplateKeyProperty | string | null | one-way, relative scope | The name of the item field whose value selects a named template variant. |
FallbackTemplateKeySetFallbackTemplateKey | string | null | — | The fallback template key used when ITemplatedComponent.TemplateKeyProperty does not resolve to a template. |
Events
OnNodeOpenWithItemKey(string command, string argumentName = "id")- Registers the command a double click or Enter on a node runs, with the node's key as an argument.
OnNodeOpen(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers the command a double click or Enter on a node runs.
OnNodeUnfoldWithItemKey(string command, string argumentName = "id")- Registers the command run when a node that says it has children is unfolded before any are in the list, with the node's key as an argument: the controller adds the children under it, or clears
HasChildren. OnNodeUnfold(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers the command run when a node that says it has children is unfolded before any are in the list.
OnNodeRenameWithItemKey(string command, string argumentName = "id")- Registers the command run after a rename wrote the node's
RenamedTitleback, with the node's key as an argument.
Optional: the two-way title already carries the new text; this is for refusing or normalizing it. OnNodeRename(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers the command run after a rename wrote the node's
RenamedTitleback. OnNodeMoveWithItemKey(string command, string argumentName = "id")- Registers the command run after a drag wrote the node's
DropTarget, with the dragged node's key as an argument; the controller moves the node under the target, or refuses by doing nothing. OnNodeMove(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers the command run after a drag wrote the node's
DropTarget. OnNodeRemoveWithItemKey(string command, string argumentName = "id")- Registers the command the Delete key runs on the node the keyboard is on, with the node's key as an argument; a node whose
CanRemoveis false raises nothing. OnNodeRemove(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers the command the Delete key runs on the node the keyboard is on.
OnRowClickWithItem(string command, string argumentName = "item")- Registers a row click command that passes the current item as an argument.
OnRowClickWithItemKey(string command, string argumentName = "id")- Registers a row click command that passes the current item's key as an argument.
OnRowClick(string command)- Registers a click command invoked when a row is clicked.
OnRowClick(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a click command invoked when a row is clicked, with UI action arguments.
OnRowClickLiteral(string command, params KeyValuePair<string, object>[] arguments)- Registers a click command invoked when a row is clicked, with literal argument values.
OnRowOpenWithItemKey(string command, string argumentName = "id")- Registers a command invoked when a row is opened — Enter on the keyboard's row, or a double click — with the row's key.
OnRowOpen(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a command invoked when a row is opened — Enter on the keyboard's row, or a double click.
OnRowRemoveWithItemKey(string command, string argumentName = "id")- Registers a command invoked when the Delete key is pressed on a row that may be removed, with the row's key; the controller removes the row or leaves it.
OnRowRemove(string command, params KeyValuePair<string, UIActionArgument>[] arguments)- Registers a command invoked when the Delete key is pressed on a row that may be removed.
Methods
ConfigureDefaultNode(Action<TreeNodeComponent> configure)- Configures the built-in node template — its glyph, its colours, the menu every node without a kind of its own opens.
SetNodeTemplate(TreeNodeComponent template)- Sets the node template a node is drawn with when no variant matches its kind.
AddNodeKind(string kind, TreeNodeComponent template)- Adds the node template the nodes of
kindare drawn with — a folder's face and menu beside a file's. AddNodeKind(string kind, Action<TreeNodeComponent> configure)- Adds a bound node template for
kindand letsconfigureshape it. SetRowTemplate(DefaultRowTemplate template)- Sets the row template.
AddItem(ITreeNodeModel item)- Adds an item to the component.
AddItems(IEnumerable<ITreeNodeModel> items)- Adds items to the component.
FilterBy(UIProperty source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by a local component property.
Defaults to a case-insensitive substring match; pass the operator explicitly where case matters. FilterBy(string sourceComponentId, UIProperty source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by another component property.
FilterBy(UIPropertyReference source, string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, UIComparisonOperator activeOperator = UIComparisonOperator.Required, object activeValue = null)- Adds a filter controlled by a property reference.
FilterBy(string itemProperty, UIComparisonOperator operator = UIComparisonOperator.LikeIgnoreCase, object value = null)- Adds an unconditionally active filter with no source, comparing against a constant value.
SortBy(UIProperty source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by a local component property.
SortBy(string sourceComponentId, UIProperty source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by another component property.
SortBy(UIPropertyReference source, string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, UIComparisonOperator activeOperator = UIComparisonOperator.Equal, object activeValue = null, int priority = 0)- Adds a sort rule controlled by a property reference.
SortBy(string itemProperty, UIItemsSortDirection direction = UIItemsSortDirection.Ascending, int priority = 0)- Adds an unconditionally active sort rule with no source.
SetEmptyTemplate(IVisualComponent visualTemplate)- Sets the template used when there are no items or no content.
Common properties (16) — layout, visibility, theme, and the rest every component shares
| Property | Type | Default | Binding | Description |
|---|---|---|---|---|
VisibilitySetVisibility · BindVisibility | UIResponsive<UIVisibility>? | Visible | one-way | What the component does with the room it was given, optionally overridden per breakpoint (e.g. collapsed from a given width up). |
EnabledSetEnabled · BindEnabled | bool? | true | one-way | Whether the component responds to input; false dims it and marks it, and its subtree, inert. |
ThemeSetTheme · BindTheme | UIThemeMode? | null | one-way | The theme mode forced on this component's subtree, or null to inherit the ambient theme. |
HorizontalAlignmentSetHorizontalAlignment · BindHorizontalAlignment | UIAlignment? | UIAlignment.Stretch | one-way | Where the component sits within its grid cell along the horizontal axis. |
VerticalAlignmentSetVerticalAlignment · BindVerticalAlignment | UIAlignment? | UIAlignment.Stretch | one-way | Where the component sits within its grid cell along the vertical axis. |
WidthSetWidth · BindWidth | UIResponsive<UILayoutLength>? | null | one-way | The component width, optionally overridden per breakpoint. |
MinWidthSetMinWidth · BindMinWidth | UIResponsive<UILayoutLength>? | null | one-way | The component minimum width, optionally overridden per breakpoint. |
MaxWidthSetMaxWidth · BindMaxWidth | UIResponsive<UILayoutLength>? | null | one-way | The component maximum width, optionally overridden per breakpoint. |
HeightSetHeight · BindHeight | UIResponsive<UILayoutLength>? | null | one-way | The component height, optionally overridden per breakpoint. |
MinHeightSetMinHeight · BindMinHeight | UIResponsive<UILayoutLength>? | null | one-way | The component minimum height, optionally overridden per breakpoint. |
MaxHeightSetMaxHeight · BindMaxHeight | UIResponsive<UILayoutLength>? | null | one-way | The component maximum height, optionally overridden per breakpoint. |
ZIndexSetZIndex · BindZIndex | int? | 0 | one-way | The stacking order within the visual tree. |
MarginSetMargin · BindMargin | UIResponsive<UIThickness>? | null | one-way | The outer spacing around the component, optionally overridden per breakpoint. |
PlacementSetPlacement · BindPlacement | UIResponsive<UIGridPlacement>? | null | one-way | The grid placement, optionally overridden per breakpoint. |
LoadingSetLoading · BindLoading | bool? | false | one-way | Whether the component is in loading state — a live state a controller turns on and off. |
ShowContextMenuSetShowContextMenu · BindShowContextMenu | bool? | true | one-way | Whether a right-click opens the IVisualComponent.ContextMenu; on a host with rows, whether it opens any row's. Off, the menu stays in the tree and nothing opens it. |