BaseVerticalCollectionView
class in UnityEngine.UIElements · UnityEngine.UIElementsModule · inherits from BindableElement
A vertical list of items made by makeItem and filled by bindItem for each entry of itemsSource, in a scroll view, with selection. Items are made when the view next updates after the source or callbacks change (RefreshItems and Rebuild bind or remake them then).
Fields 9
static readonly string borderUssClassNamestatic readonly string dragHoverBarUssClassNamestatic readonly string dragHoverMarkerUssClassNamestatic readonly string itemAlternativeBackgroundUssClassNamestatic readonly string itemDragHoverUssClassNamestatic readonly string itemSelectedVariantUssClassNamestatic readonly string itemUssClassNamestatic readonly string listScrollViewUssClassNamestatic readonly string ussClassNameProperties 21
Action<VisualElement, int>? bindItem { get; set; }VisualElement contentContainer { get; }Action<VisualElement>? destroyItem { get; set; }float fixedItemHeight { get; set; }bool horizontalScrollingEnabled { get; set; }int itemHeight { get; set; }IList? itemsSource { get; set; }Func<VisualElement>? makeItem { get; set; }bool reorderable { get; set; }Items can be dragged to new places.
float resolvedItemHeight { get; }IEnumerable<int> selectedIds { get; }int selectedIndex { get; set; }IEnumerable<int> selectedIndices { get; }object? selectedItem { get; }IEnumerable<object> selectedItems { get; }SelectionType selectionType { get; set; }AlternatingRowBackground showAlternatingRowBackgrounds { get; set; }bool showBorder { get; set; }Action<VisualElement, int>? unbindItem { get; set; }CollectionViewController viewController { get; }The controller of the view's items (made by CreateViewController).
CollectionVirtualizationMethod virtualizationMethod { get; set; }Methods 16
void AddToSelection(int index)void ClearSelection()VisualElement? GetRootElementForId(int id)VisualElement? GetRootElementForIndex(int index)The item showing an index, or null when it's out of view.
void Rebuild()Makes the items again (destroying the old ones) and binds them.
void Refresh()void RefreshItem(int index)void RefreshItems()Binds the items again (to their indices' entries), as many as the view now needs.
void RemoveFromSelection(int index)void ScrollTo(VisualElement visualElement)void ScrollToId(int id)void ScrollToItem(int index)Scrolls an item into view (-1: the last): up to its top when above, else down until it shows at the bottom, which with fixed heights goes one item further, as Unity's does.
void ScrollToItemById(int id)void SetSelection(int index)void SetSelection(IEnumerable<int> indices)void SetSelectionWithoutNotify(IEnumerable<int> indices)void SetViewController(CollectionViewController controller)Events 12
event Func<CanStartDragArgs, bool>? canStartDragAsked when an item is pressed: false keeps it from being dragged.
event Func<HandleDragAndDropArgs, DragVisualMode>? dragAndDropUpdateWhile a drag is over the view: how it shows (Rejected or None: it can't drop here).
event Func<HandleDragAndDropArgs, DragVisualMode>? handleDropOn a drop: handles it instead of the default (moving the dragged items there).
event Action<int, int>? itemIndexChangedevent Action<IEnumerable<object>>? itemsChosenevent Action? itemsSourceChangedevent Action<IEnumerable<object>>? onItemsChosenevent Action<IEnumerable<int>>? onSelectedIndicesChangeevent Action<IEnumerable<object>>? onSelectionChangeevent Action<IEnumerable<int>>? selectedIndicesChangedevent Action<IEnumerable<object>>? selectionChangedevent Func<SetupDragAndDropArgs, StartDragArgs>? setupDragAndDropWhen a drag starts: the drag's settings (title, data), changed or as given.