public MyHeaderedObservableList(IMyObservableReadOnlyList <TItem> source, Func <TItem, THeaderItem> itemToHeaderFunc)
        {
            if (typeof(THeaderItem).GetTypeInfo().ImplementedInterfaces.Contains(typeof(INotifyPropertyChanged)))
            {
                var prop = typeof(THeaderItem).GetRuntimeProperty("Collapsed");
                if (prop.PropertyType == typeof(bool))
                {
                    _collapsedHeaderProperty = prop;
                }
            }

            _itemToHeaderFunc         = itemToHeaderFunc;
            _source                   = source;
            source.CollectionChanged += Source_CollectionChanged;
            AddItems(0, source);
        }
 public static MyHeaderedObservableList <TItem, THeaderItem> ToHeaderedList <TItem, THeaderItem>(this IMyObservableReadOnlyList <TItem> source, Func <TItem, THeaderItem> itemToHeaderFunc)
 {
     return(new MyHeaderedObservableList <TItem, THeaderItem>(source, itemToHeaderFunc));
 }
예제 #3
0
 public PastCompletedHomeworkList(IMyObservableReadOnlyList <ViewItemHomework> sourceList, DateTime todayAsUtc)
 {
     base.Filter   = new FilterUsingFunction(i => !ShouldIncludeInNormalHomeworkFunction(todayAsUtc).Invoke(i));
     base.Comparer = new PastCompletedHomeworkComparer();
     base.InsertSorted(sourceList);
 }