示例#1
0
        internal RawItem GetRawItemAtGlobalSortedIndex(int index)
        {
            if (this.IsBottomLevel)
            {
                return(m_sortedRawItems[index]);
            }
            else
            {
                int count = this.ItemCount;

                for (int i = 0; i < count; i++)
                {
                    DataGridCollectionViewGroup subGroups = this.ProtectedItems[i] as DataGridCollectionViewGroup;

                    if (subGroups == null)
                    {
                        throw new InvalidOperationException("Sub-groups cannot be null (Nothing in Visual Basic).");
                    }

                    int subGroupCount = subGroups.GlobalRawItemCount;

                    if (index < subGroupCount)
                    {
                        return(subGroups.GetRawItemAtGlobalSortedIndex(index));
                    }

                    index -= subGroupCount;
                }
            }

            throw new ArgumentOutOfRangeException("index");
        }
        internal RawItem GetRawItemAtGlobalSortedIndex(int index)
        {
            if (this.IsBottomLevel)
            {
                return(m_sortedRawItems[index]);
            }
            else
            {
                foreach (object value in this.ProtectedItems)
                {
                    DataGridCollectionViewGroup subGroup = value as DataGridCollectionViewGroup;

                    int subGroupCount = subGroup.GlobalRawItemCount;

                    if (index < subGroupCount)
                    {
                        return(subGroup.GetRawItemAtGlobalSortedIndex(index));
                    }

                    index -= subGroupCount;
                }
            }

            throw new ArgumentOutOfRangeException("index");
        }