internal virtual void InsertRawItem(int index, RawItem rawItem) { Debug.Assert(this.IsBottomLevel); if (m_sortedRawItems == null) { m_sortedRawItems = new List <RawItem>(4); } m_globalRawItemCount++; DataGridCollectionViewGroup parent = m_parent; while (parent != null) { parent.m_globalRawItemCount++; parent = parent.m_parent; } int count = m_sortedRawItems.Count; for (int i = index; i < count; i++) { m_sortedRawItems[i].SetSortedIndex(i + 1); } m_sortedRawItems.Insert(index, rawItem); rawItem.SetParentGroup(this); rawItem.SetSortedIndex(index); this.ProtectedItemCount++; this.ProtectedItems.Insert(index, rawItem.DataItem); }
internal override void RemoveRawItemAt(int index) { Debug.Assert(this.IsBottomLevel); Debug.Assert(m_sortedRawItems.Count > 0); int count = m_sortedRawItems.Count; if (count == 0) { return; } if (index != -1) { m_globalRawItemCount--; for (int i = index + 1; i < count; i++) { m_sortedRawItems[i].SetSortedIndex(i - 1); } RawItem rawItem = m_sortedRawItems[index]; rawItem.SetParentGroup(null); rawItem.SetSortedIndex(-1); m_sortedRawItems.RemoveAt(index); } }
internal override void InsertRawItem(int index, RawItem rawItem) { Debug.Assert(this.IsBottomLevel); m_globalRawItemCount++; int count = m_sortedRawItems.Count; for (int i = index; i < count; i++) { m_sortedRawItems[i].SetSortedIndex(i + 1); } m_sortedRawItems.Insert(index, rawItem); rawItem.SetParentGroup(this); rawItem.SetSortedIndex(index); }
internal override void InsertRawItem( int index, RawItem rawItem ) { Debug.Assert( this.IsBottomLevel ); m_globalRawItemCount++; int count = m_sortedRawItems.Count; for( int i = index; i < count; i++ ) { m_sortedRawItems[ i ].SetSortedIndex( i + 1 ); } m_sortedRawItems.Insert( index, rawItem ); rawItem.SetParentGroup( this ); rawItem.SetSortedIndex( index ); }
internal virtual void RemoveRawItemAt(int index) { Debug.Assert(this.IsBottomLevel); Debug.Assert(m_sortedRawItems != null); if (m_sortedRawItems == null) { return; } if (index != -1) { m_globalRawItemCount--; DataGridCollectionViewGroup parent = m_parent; while (parent != null) { parent.m_globalRawItemCount--; parent = parent.Parent; } int count = m_sortedRawItems.Count; for (int i = index + 1; i < count; i++) { m_sortedRawItems[i].SetSortedIndex(i - 1); } RawItem rawItem = m_sortedRawItems[index]; rawItem.SetParentGroup(null); rawItem.SetSortedIndex(-1); m_sortedRawItems.RemoveAt(index); this.ProtectedItemCount--; this.ProtectedItems.RemoveAt(index); if ((this.ProtectedItemCount == 0) && (m_parent != null)) { m_parent.RemoveGroup(this); } } }
internal virtual void InsertRawItem( int index, RawItem rawItem ) { Debug.Assert( this.IsBottomLevel ); if( m_sortedRawItems == null ) m_sortedRawItems = new List<RawItem>( 4 ); m_globalRawItemCount++; DataGridCollectionViewGroup parent = m_parent; while( parent != null ) { parent.m_globalRawItemCount++; parent = parent.m_parent; } int count = m_sortedRawItems.Count; for( int i = index; i < count; i++ ) { m_sortedRawItems[ i ].SetSortedIndex( i + 1 ); } m_sortedRawItems.Insert( index, rawItem ); rawItem.SetParentGroup( this ); rawItem.SetSortedIndex( index ); this.ProtectedItemCount++; this.ProtectedItems.Insert( index, rawItem.DataItem ); }