BaseTreeView
class in UnityEngine.UIElements · UnityEngine.UIElementsModule · inherits from BaseVerticalCollectionView
In Tassix
A collection view of a tree: its rows are the items whose parents are all expanded, each shown with indents for its depth, a toggle (hidden without children) that expands it, and the item made by makeItem. Selection follows the items' ids across rows changing.
Fields 8
static readonly BindingId autoExpandPropertystatic readonly int invalidIdstatic readonly string itemContentContainerUssClassNamestatic readonly string itemIndentUssClassNamestatic readonly string itemIndentsContainerUssClassNamestatic readonly string itemToggleUssClassNamestatic readonly string itemUssClassNamestatic readonly string ussClassNameProperties 3
bool autoExpand { get; set; }IList? itemsSource { get; }The rows shown: the ids of the items whose parents are all expanded, in order.
BaseTreeViewController? viewController { get; }The tree's controller: none until SetRootItems makes one for the items' type.
Methods 21
void AddItem<T>(TreeViewItemData<T> item, int parentId = -1, int childIndex = -1, bool rebuildTree = true)Adds an item under a parent (-1: a root) at a child index (-1: last).
void AddToSelectionById(int id)void CollapseAll()void CollapseItem(int id, bool collapseAllChildren = false, bool refresh = true)void ExpandAll()void ExpandItem(int id, bool expandAllChildren = false, bool refresh = true)void ExpandRootItems()IEnumerable<int> GetChildrenIdsForIndex(int index)int GetIdForIndex(int index)T GetItemDataForId<T>(int id)T GetItemDataForIndex<T>(int index)int GetParentIdForIndex(int index)IEnumerable<int> GetRootIds()IEnumerable<TreeViewItemData<T>> GetSelectedItems<T>()int GetTreeCount()bool IsExpanded(int id)void RemoveFromSelectionById(int id)void SetRootItems<T>(IList<TreeViewItemData<T>> rootItems)void SetSelectionById(int id)void SetSelectionById(IEnumerable<int> ids)void SetSelectionByIdWithoutNotify(IEnumerable<int> ids)bool TryRemoveItem(int id, bool rebuildTree = true)Removes an item and its children; false when there's no such item.
Events 1
event Action<TreeViewExpansionChangedArgs>? itemExpandedChanged