跳到主要内容

Class ListView

This control binds and display an IList<T>.

Events

onRefreshBefore

public event Action onRefreshBefore;

onItemAdded

public event Action onItemAdded;

onItemRemoved

public event Action onItemRemoved;

onItemSelected

public event Action onItemSelected;

onSelectedIndexChanged

public event Action onSelectedIndexChanged;

onItemSwapped

public event Action onItemSwapped;

onDataChanged

public event Action onDataChanged;

Properties

selectedItem

Represents the currently selected item.

public T selectedItem { get; }

selectedIndex

Index of the Currently Selected List Item.

public int selectedIndex { get; set; }

draggable

Is the list item draggable?

public bool draggable { get; private set; }

removable

Is the list item deletable?

public bool removable { get; private set; }

keyboardMoveEnabled

Enable Arrow Keys for Navigation?

public bool keyboardMoveEnabled { get; private set; }

stripeItemStyleEnabled

Is Striped Style Enabled for List Items?

public bool stripeItemStyleEnabled { get; private set; }

remainsHighlightedWhenLosingFocus

Remains Highlighted When View Loses Focus?

public bool remainsHighlightedWhenLosingFocus { get; set; }

itemMinHeight

Minimum Height of Each List Item. Default is -1 (StyleKeyword.Auto).

public float itemMinHeight { get; private set; }

normalColor

public Color normalColor { get; set; }

highlightColor

public Color highlightColor { get; set; }

stripeItemColor

public Color stripeItemColor { get; set; }

data

public IList<T> data { get; private set; }

items

public IEnumerable<ListViewItem> items { get; }

itemDrawFunction

public Func<T, int, VisualElement> itemDrawFunction { get; private set; }

Methods

Up()

public void Up()

Down()

public void Down()

AddItem(T item)

public void AddItem(T item)

InsertItem(int index, T item)

public void InsertItem(int index, T item)

SetData(IList<T> data, [bool refresh = true])

public void SetData(IList<T> data, [bool refresh = true])

Refresh()

public void Refresh()

ClearAllItem()

public void ClearAllItem()

RemoveItem(T item)

public bool RemoveItem(T item)

RemoveItemAt(int index)

public void RemoveItemAt(int index)

GetItemElement(int index)

public ListViewItem GetItemElement(int index)

SetSelectedIndexWithoutNotify(int value)

public void SetSelectedIndexWithoutNotify(int value)

SetDraggable(bool draggable, [bool refresh = true])

public void SetDraggable(bool draggable, [bool refresh = true])

SetRemovable(bool removable, [bool refresh = true])

public void SetRemovable(bool removable, [bool refresh = true])

SetStripeItemStyle(bool enable, [bool refresh = true])

Sets whether the items in the list use striped styles.

public void SetStripeItemStyle(bool enable, [bool refresh = true])

SetKeyboardMoveEnabled(bool enable)

public void SetKeyboardMoveEnabled(bool enable)

SetItemMinHeight(float itemMinHeight, [bool refresh = true])

Sets the minimum height of list items. If itemMinHeight is less than 0, it represents StyleKeyword.Auto.

public void SetItemMinHeight(float itemMinHeight, [bool refresh = true])

SetItemDrawFunction(Func<T, int, VisualElement> itemDrawFunction, [bool refresh = true])

public void SetItemDrawFunction(Func<T, int, VisualElement> itemDrawFunction, [bool refresh = true])