Exemple #1
0
        // Token: 0x060073A1 RID: 29601 RVA: 0x00211674 File Offset: 0x0020F874
        internal int LeafIndexOf(object item)
        {
            int num   = 0;
            int i     = 0;
            int count = base.Items.Count;

            while (i < count)
            {
                CollectionViewGroupInternal collectionViewGroupInternal = base.Items[i] as CollectionViewGroupInternal;
                if (collectionViewGroupInternal != null)
                {
                    int num2 = collectionViewGroupInternal.LeafIndexOf(item);
                    if (num2 >= 0)
                    {
                        return(num + num2);
                    }
                    num += collectionViewGroupInternal.ItemCount;
                }
                else
                {
                    if (ItemsControl.EqualsEx(item, base.Items[i]))
                    {
                        return(num);
                    }
                    num++;
                }
                i++;
            }
            return(-1);
        }
        // return the index of the given item within the list of leaves governed
        // by this group
        internal int LeafIndexOf(object item)
        {
            int leaves = 0;         // number of leaves we've passed over so far

            for (int k = 0, n = Items.Count; k < n; ++k)
            {
                CollectionViewGroupInternal subgroup = Items[k] as CollectionViewGroupInternal;
                if (subgroup != null)
                {
                    int subgroupIndex = subgroup.LeafIndexOf(item);
                    if (subgroupIndex < 0)
                    {
                        leaves += subgroup.ItemCount;       // item not in this subgroup
                    }
                    else
                    {
                        return(leaves + subgroupIndex);     // item is in this subgroup
                    }
                }
                else
                {
                    // current item is a leaf - compare it directly
                    if (System.Windows.Controls.ItemsControl.EqualsEx(item, Items[k]))
                    {
                        return(leaves);
                    }
                    else
                    {
                        leaves += 1;
                    }
                }
            }

            // item not found
            return(-1);
        }