Ejemplo n.º 1
0
 private void UpdateFilter()
 {
     if (Time.time > m_nextUpdateTime)
     {
         m_nextUpdateTime = float.PositiveInfinity;
         IEnumerable selectedItems = TreeView.SelectedItems;
         m_filteredItems.Clear();
         if (!string.IsNullOrEmpty(m_txtFilter.text))
         {
             Filter(m_txtFilter.text, m_dataItems, m_filteredItems);
             TreeView.Items         = m_filteredItems;
             TreeView.SelectedItems = selectedItems;
         }
         else
         {
             TreeView.Items         = m_dataItems;
             TreeView.SelectedItems = selectedItems;
             if (TreeView.SelectedItemsCount > 0)
             {
                 foreach (DataItem selectedItem in TreeView.SelectedItems)
                 {
                     TreeView.ExpandTo(selectedItem, dataItem => dataItem.Parent);
                 }
             }
         }
     }
 }
 public static void ExpandAll <T>(
     this VirtualizingTreeView treeView,
     T item,
     Func <T, T> getParent,
     Func <T, IEnumerable> getChildren)
 {
     treeView.ExpandTo <T>(getParent(item), getParent);
     treeView.ExpandChildren <T>(item, getChildren);
 }
        public static void ExpandTo <T>(this VirtualizingTreeView treeView, T item, Func <T, T> getParent)
        {
            if (item == null)
            {
                return;
            }
            ItemContainerData containerData = treeView.GetItemContainerData(item);

            if (containerData == null)
            {
                treeView.ExpandTo(getParent(item), getParent);
                treeView.Expand(item);
            }
            else
            {
                treeView.Expand(item);
            }
        }
 public static void ExpandTo <T>(
     this VirtualizingTreeView treeView,
     T item,
     Func <T, T> getParent)
 {
     if ((object)item == null)
     {
         return;
     }
     if (treeView.GetItemContainerData((object)item) == null)
     {
         treeView.ExpandTo <T>(getParent(item), getParent);
         treeView.Expand((object)item);
     }
     else
     {
         treeView.Expand((object)item);
     }
 }