public object this[int index]
        {
            get
            {
                if ((index < 0) || (index >= m_list.ItemsCount))
                {
                    throw new ArgumentOutOfRangeException("index", "The index must be equal or greater than zero and less than Count.");
                }

                int oldIndexOffset = 0;
                int indexOffset    = 0;
                int count          = m_list.Count;

                for (int i = 0; i < count; i++)
                {
                    SelectionRangeWithItems rangeWithItems = m_list[i];
                    indexOffset += rangeWithItems.Length;

                    if (index < indexOffset)
                    {
                        return(rangeWithItems.GetItem(m_list.DataGridContext, index - oldIndexOffset));
                    }

                    oldIndexOffset = indexOffset;
                }

                throw new ArgumentOutOfRangeException("index", "The index must be less than Count.");
            }
            set
            {
                throw new NotSupportedException();
            }
        }
        public void CopyTo(object[] array, int arrayIndex)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            int             count           = m_list.Count;

            for (int i = 0; i < count; i++)
            {
                SelectionRangeWithItems rangeWithItems = m_list[i];
                int rangeLength = rangeWithItems.Length;

                for (int j = 0; j < rangeLength; j++)
                {
                    array[arrayIndex] = rangeWithItems.GetItem(dataGridContext, j);
                    arrayIndex++;
                }
            }
        }
        void ICollection.CopyTo(Array array, int arrayIndex)
        {
            DataGridContext dataGridContext = m_list.DataGridContext;
            int             count           = m_list.Count;

            for (int i = 0; i < count; i++)
            {
                SelectionRangeWithItems rangeWithItems = m_list[i];
                int rangeLength = rangeWithItems.Length;

                for (int j = 0; j < rangeLength; j++)
                {
                    array.SetValue(rangeWithItems.GetItem(dataGridContext, j), arrayIndex);
                    arrayIndex++;
                }
            }
        }
        public void RemoveAt(int index)
        {
            if ((index < 0) || (index >= m_list.ItemsCount))
            {
                throw new ArgumentOutOfRangeException("index", index, "index must be greater than or equal to zero and less than Count.");
            }

            int oldIndexOffset = 0;
            int indexOffset    = 0;
            int count          = m_list.Count;
            SelectionRangeWithItems rangeWithItemsFound = SelectionRangeWithItems.Empty;

            for (int i = 0; i < count; i++)
            {
                SelectionRangeWithItems rangeWithItems = m_list[i];
                indexOffset += rangeWithItems.Length;

                if (index < indexOffset)
                {
                    rangeWithItemsFound = rangeWithItems; // .GetItem( dataGridContext, index - oldIndexOffset );
                    break;
                }

                oldIndexOffset = indexOffset;
            }

            if (!rangeWithItemsFound.IsEmpty)
            {
                DataGridContext  dataGridContext  = m_list.DataGridContext;
                SelectionManager selectionManager = dataGridContext.DataGridControl.SelectionChangerManager;
                selectionManager.Begin();

                try
                {
                    selectionManager.UnselectItems(dataGridContext,
                                                   new SelectionRangeWithItems(
                                                       rangeWithItemsFound.Range.GetIndexFromItemOffset(index - oldIndexOffset),
                                                       rangeWithItemsFound.GetItem(dataGridContext, index - oldIndexOffset)));
                }
                finally
                {
                    selectionManager.End(false, true, true);
                }
            }
        }