BaseTreeView
Base class for a tree view, a vertically scrollable area that links to, and displays, a list of items organized in a tree.
Read time 10 minutesLast updated 5 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: BaseVerticalCollectionView
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, IBindable, ISerializationCallbackReceiver
public abstract class BaseTreeView : BaseVerticalCollectionView, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle, IBindable, ISerializationCallbackReceiver
Remarks
For the difference between IDs and indices, refer to BaseVerticalCollectionView.
Static Fields
Value | Description |
|---|---|
| itemContentContainerUssClassName | The USS class name for TreeView item container elements. |
| itemIndentUssClassName | The USS class name for TreeView indent element. |
| itemToggleUssClassName | The USS class name for TreeView item toggle elements. |
| itemUssClassName | The USS class name for TreeView item elements. |
| ussClassName | The USS class name for TreeView elements. |
Constructors
Constructor | Description |
|---|---|
| BaseTreeView() | Creates a TreeView with all default properties. |
| BaseTreeView(System.Int32) | Creates a TreeView with specified factory methods using the fixed height virtualization method. |
Properties
Property | Description |
|---|---|
| autoExpand | When true, items are automatically expanded when added to the TreeView. |
| itemsSource | Access to the itemsSource. For a TreeView, the source contains the items wrappers. |
| viewController | The view controller for this view, cast as a BaseTreeViewController. |
Methods
Method | Description |
|---|---|
| AddItem | Adds an item to the existing tree. |
| AddToSelectionById | Adds an item to the current selection by id. |
| CollapseAll | Collapses all TreeView items, including children. |
| CollapseItem | Collapses the specified TreeView item. |
| ExpandAll | Expands all TreeView items, including children. |
| ExpandItem | Expands the specified TreeView item. |
| ExpandRootItems | Expands all root TreeView items. |
| GetChildrenIdsForIndex | Gets children identifiers for the specified TreeView item. |
| GetIdForIndex | Gets the specified TreeView item's identifier. |
| GetItemDataForId | Gets data for the specified TreeView item id. |
| GetItemDataForIndex | Gets data for the specified TreeView item index. |
| GetParentIdForIndex | Gets the specified TreeView item's parent identifier. |
| GetRootIds | Gets the root item identifiers. |
| GetSelectedItems | Gets tree data for the selected item indices. |
| GetTreeCount | Gets the TreeView's total number of items. |
| IsExpanded | Returns true if the specified TreeView item is expanded, false otherwise. |
| RemoveFromSelectionById | Removes an item from the current selection by id. |
| SetRootItems | Sets the root items to use with the default tree view controller. |
| SetSelectionById | Sets a collection of selected items by ids. |
| SetSelectionByIdWithoutNotify | Sets a collection of selected items by id, without triggering a selection change callback. |
| SetViewController | Assigns the view controller for this view and registers all events required for it to function properly. |
| TryRemoveItem | Removes an item of the tree if it can find it. |
Events
Member | Description |
|---|---|
| itemExpandedChanged | Raised when an item is expanded or collapsed. |