# BaseTreeViewController

> Base collection tree view controller. View controllers of this type are meant to take care of data virtualized by any BaseTreeView inheritor.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule
* **Inherits from:** [CollectionViewController](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller.md)
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public abstract class BaseTreeViewController : CollectionViewController, IDisposable
```

## Constructors

| Constructor                                                                                                       | Description                              |
| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [BaseTreeViewController()](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/ctor.md) | Constructor for a BaseTreeViewController |

## Properties

| Property                                                                                                      | Description                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| [baseTreeView](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/basetreeview.md) | View for this controller, cast as a [BaseTreeView](/engine/6000.7/script-reference/unityengine/uielements/basetreeview.md). |
| [itemsSource](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/itemssource.md)   | Items for this tree.                                                                                                        |

## Methods

| Method                                                                                                                                    | Description                                                                                                                   |
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [CanChangeExpandedState](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/canchangeexpandedstate.md)         | Determines whether the item with the specified ID can be expanded or collapsed.                                               |
| [CollapseAll](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/collapseall.md)                               | Collapses all items in the tree and refreshes the view.                                                                       |
| [CollapseItem](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/collapseitem.md)                             | Collapses the item with the specified ID, hiding its children. Allows to collapse the whole hierarchy under that item.        |
| [CollapseItemByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/collapseitembyindex.md)               | Collapses the item with the specified index, hiding its children. Allows to collapse the whole hierarchy under that item.     |
| [Exists](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/exists.md)                                         | Checks if an ID exists within this tree.                                                                                      |
| [ExpandAll](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/expandall.md)                                   | Expands all items in the tree and refreshes the view.                                                                         |
| [ExpandItem](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/expanditem.md)                                 | Expands the item with the specified ID, making its children visible. Allows to expand the whole hierarchy under that item.    |
| [ExpandItemByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/expanditembyindex.md)                   | Expands the item with the specified index, making his children visible. Allows to expand the whole hierarchy under that item. |
| [GetAllItemIds](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getallitemids.md)                           | Returns all item IDs that can be found in the tree, optionally specifying root IDs from where to start.                       |
| [GetChildIndexForId](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getchildindexforid.md)                 | Gets the child index under the parent of the item with the specified ID.                                                      |
| [GetChildrenIds](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getchildrenids.md)                         | Get all children of a specific ID in the tree.                                                                                |
| [GetChildrenIdsByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getchildrenidsbyindex.md)           | Gets the children IDs of the item with the specified index.                                                                   |
| [GetIdForIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getidforindex.md)                           | Returns the ID for a specified index in the visible items source.                                                             |
| [GetIndentationDepth](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getindentationdepth.md)               | Returns the depth of the element at that ID.                                                                                  |
| [GetIndentationDepthByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getindentationdepthbyindex.md) | Return the depth of the element at that index.                                                                                |
| [GetIndexForId](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getindexforid.md)                           | Returns the index in the source of the item, by ID.                                                                           |
| [GetParentId](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getparentid.md)                               | Returns the parent ID of an item, by ID.                                                                                      |
| [GetRootItemIds](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/getrootitemids.md)                         | Returns the root items of the tree, by IDs.                                                                                   |
| [GetTreeItemsCount](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/gettreeitemscount.md)                   | Get the number of items in the whole tree.                                                                                    |
| [HasChildren](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/haschildren.md)                               | Return whether the item with the specified ID has one or more child.                                                          |
| [HasChildrenByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/haschildrenbyindex.md)                 | Return whether the item with the specified index has one or more child.                                                       |
| [IsExpanded](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/isexpanded.md)                                 | Return whether the item with the specified ID is expanded in the tree.                                                        |
| [IsExpandedByIndex](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/isexpandedbyindex.md)                   | Return whether the item with the specified index is expanded in the tree.                                                     |
| [Move](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/move.md)                                             | Moves an item by ID, to a new parent and child index.                                                                         |
| [TryRemoveItem](/engine/6000.7/script-reference/unityengine/uielements/basetreeviewcontroller/tryremoveitem.md)                           | Removes an item by id.                                                                                                        |

## Inheritance

**Inherited Members:**

* [CollectionViewController.SetItemsSourceWithoutNotify(IList)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/setitemssourcewithoutnotify.md)
* [CollectionViewController.SetView(BaseVerticalCollectionView)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/setview.md)
* [CollectionViewController.PrepareView()](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/prepareview.md)
* [CollectionViewController.Dispose()](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/dispose.md)
* [CollectionViewController.GetItemsCount()](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/getitemscount.md)
* [CollectionViewController.GetItemForIndex(int)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/getitemforindex.md)
* [CollectionViewController.GetItemForId(int)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/getitemforid.md)
* [CollectionViewController.MakeItem()](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/makeitem.md)
* [CollectionViewController.BindItem(VisualElement, int)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/binditem.md)
* [CollectionViewController.UnbindItem(VisualElement, int)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/unbinditem.md)
* [CollectionViewController.DestroyItem(VisualElement)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/destroyitem.md)
* [CollectionViewController.RaiseItemsSourceChanged()](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/raiseitemssourcechanged.md)
* [CollectionViewController.RaiseItemIndexChanged(int, int)](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/raiseitemindexchanged.md)
* [CollectionViewController.view](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/view.md)
* [CollectionViewController.itemsSourceChanged](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/itemssourcechanged.md)
* [CollectionViewController.itemIndexChanged](/engine/6000.7/script-reference/unityengine/uielements/collectionviewcontroller/itemindexchanged.md)
