Пример #1
0
        private void EnsureGroupsExists(TSource element)
        {
            var key         = _keySelectorCompiled(element);
            var groupExists = FindGroup(key, ResultCollection);

            if (!groupExists)
            {
                IBindableGrouping <TKey, TElement> newGroup = new BindableGrouping <TKey, TElement>(key, SourceCollection.Where(e => CompareKeys(_keySelectorCompiled(e), key)).DependsOnExpression(_keySelector.Body, _keySelector.Parameters[0]).Select(_elementSelector), Dispatcher);
                newGroup.CollectionChanged += Group_CollectionChanged;
                ResultCollection.Add(newGroup);
            }
        }
Пример #2
0
        private void EnsureGroupsExists(TSource element)
        {
            var key = _keySelectorCompiled(element);

            if (FindGroup(key, ResultCollection))
            {
                return;
            }
            IBindableGrouping <TKey, TElement> bindableGrouping = new BindableGrouping <TKey, TElement>(key, (from e in SourceCollection
                                                                                                              where CompareKeys(_keySelectorCompiled(e), key)
                                                                                                              select e).WithDependencyExpression(_keySelector.Body, _keySelector.Parameters[0]).Select(_elementSelector), Dispatcher);

            bindableGrouping.CollectionChanged += Group_CollectionChanged;
            ResultCollection.Add(bindableGrouping);
        }