# TreeView

> Creates a TreeView with all default properties.

## Definition

* **Type:** Constructor
* **Namespace:** [UnityEngine.UIElements](/engine/6000.6/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## TreeView()

Creates a [TreeView](/engine/6000.6/script-reference/unityengine/uielements/treeview.md) with all default properties.

```csharp
public TreeView()
```

### Remarks

Use [BaseTreeView.SetRootItems](/engine/6000.6/script-reference/unityengine/uielements/basetreeview/setrootitems.md) to add content.

## TreeView(Func\<VisualElement>, Action\<VisualElement, int>)

Creates a [TreeView](/engine/6000.6/script-reference/unityengine/uielements/treeview.md) with specified factory methods.

```csharp
public TreeView(Func<VisualElement> makeItem, Action<VisualElement, int> bindItem)
```

### Parameters

**** (\[Func\<VisualElement>]\(https\://learn.microsoft.com/dotnet/api/system.func-1)): The factory method to call to create a display item. The method should return a VisualElement that can be bound to a data item.**** (\[Action\<VisualElement, int>]\(https\://learn.microsoft.com/dotnet/api/system.action)): The method to call to bind a data item to a display item. The method receives as parameters the display item to bind, and the index of the data item to bind it to.

### Remarks

Use [BaseTreeView.SetRootItems](/engine/6000.6/script-reference/unityengine/uielements/basetreeview/setrootitems.md) to add content.

## TreeView(int, Func\<VisualElement>, Action\<VisualElement, int>)

Creates a [TreeView](/engine/6000.6/script-reference/unityengine/uielements/treeview.md) with specified factory methods using the fixed height virtualization method.

```csharp
public TreeView(int itemHeight, Func<VisualElement> makeItem, Action<VisualElement, int> bindItem)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The item height to use in FixedHeight virtualization mode.**** (\[Func\<VisualElement>]\(https\://learn.microsoft.com/dotnet/api/system.func-1)): The factory method to call to create a display item. The method should return a VisualElement that can be bound to a data item.**** (\[Action\<VisualElement, int>]\(https\://learn.microsoft.com/dotnet/api/system.action)): The method to call to bind a data item to a display item. The method receives as parameters the display item to bind, and the index of the data item to bind it to.

### Remarks

Use [BaseTreeView.SetRootItems](/engine/6000.6/script-reference/unityengine/uielements/basetreeview/setrootitems.md) to add content.
