Beispiel #1
0
        private void AddToSubgroups(object item, CollectionViewGroupInternal group, int level, bool loading)
        {
            var name = this.GetGroupName(item, group.GroupBy, level);

            if (name == UseAsItemDirectly)
            {
                if (loading)
                {
                    group.Add(item);
                }
                else
                {
                    var index = group.Insert(item, item, this.ActiveComparer);
                    var num2  = group.LeafIndexFromItem(item, index);
                    this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, num2));
                }
            }
            else
            {
                var is2 = name as ICollection;
                if (is2 == null)
                {
                    this.AddToSubgroup(item, group, level, name, loading);
                }
                else
                {
                    foreach (var obj3 in is2)
                    {
                        this.AddToSubgroup(item, group, level, obj3, loading);
                    }
                }
            }
        }
Beispiel #2
0
        private void AddToSubgroup(object item, CollectionViewGroupInternal group, int level, object name, bool loading)
        {
            CollectionViewGroupInternal internal2;
            var num   = this.IsDataInGroupOrder ? group.LastIndex : 0;
            var count = group.Items.Count;

            while (num < count)
            {
                internal2 = group.Items[num] as CollectionViewGroupInternal;
                if ((internal2 != null) && group.GroupBy.NamesMatch(internal2.Name, name))
                {
                    group.LastIndex = num;
                    this.AddToSubgroups(item, internal2, level + 1, loading);
                    return;
                }
                num++;
            }
            internal2 = new CollectionViewGroupInternal(name, group);
            this.InitializeGroup(internal2, level + 1);
            if (loading)
            {
                group.Add(internal2);
                group.LastIndex = num;
            }
            else
            {
                group.Insert(internal2, item, this.ActiveComparer);
            }
            this.AddToSubgroups(item, internal2, level + 1, loading);
        }
Beispiel #3
0
        private void InitializeGroup(CollectionViewGroupInternal group, int level)
        {
            var groupDescription = this.GetGroupDescription(group, level);

            group.GroupBy = groupDescription;
            var observables = (groupDescription != null) ? groupDescription.GroupNames : null;

            if (observables != null)
            {
                var num   = 0;
                var count = observables.Count;
                while (num < count)
                {
                    var internal2 = new CollectionViewGroupInternal(observables[num], group);
                    this.InitializeGroup(internal2, level + 1);
                    group.Add(internal2);
                    num++;
                }
            }
            group.LastIndex = 0;
        }