Show / Hide Table of Contents

Class ListViewBinder

This class contains common functions for binding a ListView to a list in Unity's UI Toolkit.

Inheritance
System.Object
ListViewBinder
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CarbideFunction.Wildtile.Editor
Syntax
public static class ListViewBinder

Fields

defaultItemHeight

Declaration
public const int defaultItemHeight = 16
Field Value
Type Description
System.Int32

Methods

BindListView<TContents>(ListView, IEnumerable<TContents>)

Add data to the list view.

Declaration
public static void BindListView<TContents>(ListView listView, IEnumerable<TContents> contents)
Parameters
Type Name Description
ListView listView
System.Collections.Generic.IEnumerable<TContents> contents
Type Parameters
Name Description
TContents

SetupListViewInitial<TContents>(ListView, ListViewBinder.ApplyContentsToUi<TContents>, Int32, Func<VisualElement>)

Set up a list view for the first time. This only needs to be called once for a list view, and must be called before BindListView<TContents>(ListView, IEnumerable<TContents>) is called.

Declaration
public static void SetupListViewInitial<TContents>(ListView listView, ListViewBinder.ApplyContentsToUi<TContents> applyContentsToUi, int itemHeight = 16, Func<VisualElement> createEmptyItemElement = null)
Parameters
Type Name Description
ListView listView
ListViewBinder.ApplyContentsToUi<TContents> applyContentsToUi
System.Int32 itemHeight
System.Func<VisualElement> createEmptyItemElement

Pass in a custom constructor that will be used to create different UI elements in the list view. If this parameter is missing or null then ListViewBinder will default to creating a single label for each item.

Type Parameters
Name Description
TContents
In This Article
Generated by DocFX Version: 3.2.1 - click to show/hide other versions