示例#1
0
        void BindTreeViewItem(VisualElement element, int index)
        {
            var visualProgressItem = element as VisualProgressItem;

            if (visualProgressItem == null)
            {
                return;
            }

            var progressItem = m_TreeView.GetItemDataForIndex <Progress.Item>(index);

            visualProgressItem.BindItem(progressItem);

            var indentLevel = GetIndentationLevel(index);
            var rootVE      = m_TreeView.GetRootElementForIndex(index);
            var isEven      = indentLevel % 2 == 0;

            rootVE.EnableInClassList("unity-tree-view__item-indent-even", isEven);
            rootVE.EnableInClassList("unity-tree-view__item-indent-odd", !isEven);
        }