Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BaseListView

Base class for a list view, a vertically scrollable area that links to, and displays, a list of items.
Read time 13 minutesLast updated 4 days ago

Definition

[UxmlElement]public abstract class BaseListView : 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

arraySizeFieldUssClassNameThe USS class name for the size field of the ListView when show bound collection size is enabled
arraySizeFieldWithFooterUssClassNameThe USS class name for the size field of the ListView when the footer is enabled.
arraySizeFieldWithHeaderUssClassNameThe USS class name for the size field of the ListView when foldout header is enabled.
emptyLabelUssClassNameThe USS class name for label displayed when ListView is empty.
foldoutHeaderUssClassNameThe USS class name for the foldout header of the ListView.
footerAddButtonNameThe name of the add button element in the footer.
footerRemoveButtonNameThe name of the remove button element in the footer.
footerUssClassNameThe USS class name for the footer of the ListView.
itemUssClassNameThe USS class name of item elements in ListView elements.
listViewWithFooterUssClassNameThe USS class name for ListView when add/remove footer is enabled.
listViewWithHeaderUssClassNameThe USS class name for ListView when foldout header is enabled.
overMaxMultiEditLimitClassNameThe USS class name for label displayed when ListView is trying to edit too many items.
reorderableItemContainerUssClassNameThe USS class name for item container in reorderable animated ListView.
reorderableItemHandleBarUssClassNameThe USS class name for drag handle bar in reorderable animated ListView.
reorderableItemHandleUssClassNameThe USS class name for drag handle in reorderable animated ListView.
reorderableItemUssClassNameThe USS class name for item elements in reorderable animated ListView.
reorderableUssClassNameThe USS class name for reorderable animated ListView elements.
scrollViewWithFooterUssClassNameThe USS class name for scroll view when add/remove footer is enabled.
ussClassNameThe USS class name for ListView elements.

Constructors

Constructor

Description

BaseListView()Creates a BaseListView with all default properties. The _itemsSource must all be set for the BaseListView to function properly.
BaseListView(System.Collections.IList,System.Single)Constructs a BaseListView, with all important properties provided.

Properties

Property

Description

allowAddThis property allows the user to allow or block the addition of an item when clicking on the Add Button. It must return
true
or
false
.
allowRemoveThis property allows the user to allow or block the removal of an item when clicking on the Remove Button. It must return
true
or
false
.
bindingSourceSelectionModeThis property controls whether every element in the list will get its data source setup automatically to the correct item in the collection's source.
headerTitleThis property controls the text of the foldout header when using _showFoldoutHeader.
makeFooterThis callback allows the user to make their own footer for this control.
makeHeaderThis callback allows the user to make their own header for this control.
makeNoneElementThis callback allows the user to set a Visual Element to replace the "List is empty" Label shown when the ListView is empty.
onAddThis callback allows the user to implement their own code to be executed when the Add Button is clicked.
onRemoveThis callback allows the user to implement their own code to be executed when the Remove Button is clicked.
overridingAddButtonBehaviorThis callback allows the user to implement a DropdownMenu when the Add Button is clicked.
reorderModeThis property controls the drag and drop mode for the list view.
showAddRemoveFooterThis property controls whether a footer will be added to the list view.
showBoundCollectionSizeThis property controls whether the list view displays the collection size (number of items).
showFoldoutHeaderThis property controls whether the list view displays a header, in the form of a foldout that can be expanded or collapsed.
viewControllerThe view controller for this view, cast as a BaseListViewController.

Methods

Method

Description

SetViewControllerAssigns the view controller for this view and registers all events required for it to function properly.

Events

Member

Description

itemsAddedThis event is called for every item added to the itemsSource. Includes the item index.
itemsRemovedThis event is called for every item removed from the itemsSource. Includes the item index.

Inheritance

Inherited Members