- List view displays items as a flat list unlike tree view which displays items in a multi-tiered hierarchy
- This control only creates visual elements for visible items while allowing the binding of many more items
- As the user scrolls, visual elements in list view are recycled and re-bound to new data items
Choosing between foldout, list view, and tree view
- Tree view is used for displaying items in a multi-tiered hierarchy, like a folder structure
- List view is used for displaying items as a flat list
- Foldout is used to expand / collapse a single level of mixed content, like Inspector controls
Using a foldout with list view
Do not manually insert a foldout control inside list view. Instead use list view’s built-in option for adding a foldout.
Alternating row backgrounds
Use showAlternatingRowBackgrounds property to add alternating row background colors to the list view.
Use showBorder property to show a border around the list view.
Selecting list items
Selection state can be set to disable selections, have one selectable item, or have multiple selectable items by using selectionType property.
List view items can be dragged to reorder their position by using reorderable property.
Anatomy and layout
A list view can contain and be paired with the following elements:
1. List view foldout
2. List view
3. List view row
Default state of a list view row.
When hovered, list view rows are highlighted.
When selected, list view rows are highlighted.
When focused, list view rows are highlighted in blue.
Disabled list view items.
1. List view item backgrounds
The alternate background color for views with alternating row colors
The background color for selected items or selected text
The background color for line items when the mouse pointer hovers over them
rgba(256, 256, 256, 0.0627451)
The background color for an item with a line specific background color when the mouse pointer hovers over them
The background color for selected items or selected text when the control does not have focus
2. List view item label
The default text color when the mouse pointer hovers over the text
The text color for a label when it has focus