/// <summary>
        /// Generates a sublist from the current list, using the given filter. Sublist continues to update with main list.
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public MyObservableList <T> Sublist(IFilter <T> filter)
        {
            MyObservableList <T> list = new MyObservableList <T>()
            {
                Filter        = filter,
                Comparer      = Comparer,
                InsertAdapter = InsertAdapter
            };

            list.InsertSorted(this);

            return(list);
        }
Beispiel #2
0
        public MySublistsToFlatHeaderedList(MyObservableList <TTopItem> source, Func <TTopItem, MyObservableList <TSubItem> > selectChildrenFunc, object topHeader)
        {
            if (topHeader != null)
            {
                _topHeader = topHeader;
                Add(topHeader);
            }

            _selectChildrenFunc       = selectChildrenFunc;
            source.CollectionChanged += Source_CollectionChanged;

            AddTopLevelItems(0, source);
        }
Beispiel #3
0
        private int FindStartOfSubItems(MyObservableList <TSubItem> subItemsList)
        {
            for (int i = GetStartIndex(); i < Count; i++)
            {
                var item = this[i];

                // If the current item is the parent of this sublist
                if (item is TTopItem && _selectChildrenFunc((TTopItem)item) == subItemsList)
                {
                    return(i + 1);
                }
            }

            return(-1);
        }
Beispiel #4
0
 public MyObservableOfTypeList(MyObservableList <TSource> source)
 {
     _filtered = source.Sublist(i => i is TFinal);
     _filtered.CollectionChanged += _filtered_CollectionChanged;
 }