internal void Clear()
        {
            // reset the counts before delving into subgroups.   The subgroup
            // changes can incur re-entrant calls to LeafAt(index) which will
            // get out-of-range exceptions (DDVSO 656948), unless we fend them
            // off by ensuring that count<=index.
            FullCount          = 1;
            ProtectedItemCount = 0;

            if (_groupBy != null)
            {
                // This group has subgroups.  Disconnect from GroupDescription events
                PropertyChangedEventManager.RemoveHandler(_groupBy, OnGroupByChanged, String.Empty);
                _groupBy = null;

                // recursively clear subgroups
                for (int i = 0, n = ProtectedItems.Count; i < n; ++i)
                {
                    CollectionViewGroupInternal subGroup = ProtectedItems[i] as CollectionViewGroupInternal;
                    if (subGroup != null)
                    {
                        subGroup.Clear();
                    }
                }
            }

            ProtectedItems.Clear();
            if (_nameToGroupMap != null)
            {
                _nameToGroupMap.Clear();
            }
        }
Esempio n. 2
0
        internal void Clear()
        {
            if (_groupBy != null)
            {
                // This group has subgroups.  Disconnect from GroupDescription events
                PropertyChangedEventManager.RemoveHandler(_groupBy, OnGroupByChanged, String.Empty);
                _groupBy = null;

                // recursively clear subgroups
                for (int i = 0, n = ProtectedItems.Count; i < n; ++i)
                {
                    CollectionViewGroupInternal subGroup = ProtectedItems[i] as CollectionViewGroupInternal;
                    if (subGroup != null)
                    {
                        subGroup.Clear();
                    }
                }
            }

            FullCount          = 1;
            ProtectedItemCount = 0;
            ProtectedItems.Clear();
            if (_nameToGroupMap != null)
            {
                _nameToGroupMap.Clear();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Internal use only.
        /// </summary>
        /// <param name="items"></param>
        /// <returns></returns>
        public ReadOnlyObservableCollection <Object> BuildGroupsFromList(IList items)
        {
            ProtectedItems.Clear();

            foreach (var item in items)
            {
                AddItemToGroup(item, 0, this);
            }
            return(this.Items);
        }
Esempio n. 4
0
 internal void Clear()
 {
     FullCount          = 1;
     ProtectedItemCount = 0;
     ProtectedItems.Clear();
     if (_nameToGroupMap != null)
     {
         _nameToGroupMap.Clear();
     }
 }
Esempio n. 5
0
        internal void ClearSubtree()
        {
            ProtectedItems.Clear();
            CollectionChanged.Raise(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            return;
//			if (IsBottomLevel) {
//				ClearItems ();
//			} else {
//				foreach (StandardCollectionViewGroup g in Items)
//					g.ClearSubtree ();
//			}
        }
        private void CollectionViewGroupProxy_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            var copy = _wrapped.Group.ToList();

            _dispatcher.Invoke(() =>
            {
                ProtectedItems.Clear();
                foreach (var item in copy)
                {
                    ProtectedItems.Add(item);
                }
                ProtectedItemCount = copy.Count;
            });
        }
Esempio n. 7
0
 /// <summary>
 /// Clears the collection of items
 /// </summary>
 internal void Clear()
 {
     ProtectedItems.Clear();
     FullCount          = 1;
     ProtectedItemCount = 0;
 }
Esempio n. 8
0
 internal void ClearItems()
 {
     ProtectedItems.Clear();
     ProtectedItemCount = 0;
 }