Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TreeView

A TreeView is a vertically scrollable area that links to, and displays, a list of items organized in a tree.
Read time 11 minutesLast updated 2 days ago

Definition

public class TreeView : BaseTreeView, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IBindable, ISerializationCallbackReceiver

Remarks

A TreeView is a ScrollView with additional logic to display a tree of vertically-arranged VisualElements. Each VisualElement in the tree is bound to a corresponding element in a data-source list. The data-source list can contain elements of any type.
The logic required to create VisualElements, and to bind them to or unbind them from the data source, varies depending on the intended result. It's up to you to implement logic that is appropriate to your use case. For the ListView to function correctly, you must supply at least the following:
It is also recommended to supply the following for more complex items:
The TreeView creates VisualElements for the visible items, and supports binding many more. As the user scrolls, the TreeView recycles VisualElements and re-binds them to new data items.
For more information, refer to UXML element TreeView.

Constructors

Properties

Property

Description

bindItemCallback for binding a data item to the visual element.
destroyItemCallback invoked when a VisualElement created via TreeView.makeItem is no longer needed and will be destroyed.
itemTemplateA UXML template that constructs each recycled and rebound element within the tree. This template is designed to replace the TreeView.makeItem definition.
makeItemCallback for constructing the VisualElement that is the template for each recycled and re-bound element in the list.
unbindItemCallback for unbinding a data item from the VisualElement.
viewControllerThe view controller for this view, cast as a TreeViewController.

Inheritance

Inherited Members