public ObservableItemSource(IEnumerable itemSource, ICollectionChangedNotifier changedNotifier) { itemsSource = itemSource as IList ?? itemSource as IEnumerable; notifier = changedNotifier; ((INotifyCollectionChanged)itemSource).CollectionChanged += CollectionChanged; }
public ObservableItemsSource(IList itemSource, ICollectionChangedNotifier notifier) { _itemsSource = itemSource; _notifier = notifier; ((INotifyCollectionChanged)itemSource).CollectionChanged += CollectionChanged; }
public ObservableItemsSource(IEnumerable itemSource, BindableObject container, ICollectionChangedNotifier notifier) { _itemsSource = itemSource as IList ?? itemSource as IEnumerable; _container = container; _notifier = notifier; ((INotifyCollectionChanged)itemSource).CollectionChanged += CollectionChanged; }
public ObservableGroupedSource(GroupableItemsView groupableItemsView, ICollectionChangedNotifier notifier) { var groupSource = groupableItemsView.ItemsSource; _notifier = notifier; _groupSource = groupSource as IList ?? new ListSource(groupSource); _hasGroupFooters = groupableItemsView.GroupFooterTemplate != null; _hasGroupHeaders = groupableItemsView.GroupHeaderTemplate != null; if (_groupSource is INotifyCollectionChanged incc) { incc.CollectionChanged += CollectionChanged; } UpdateGroupTracking(); }
public static IItemsViewSource Create(IEnumerable itemsSource, ICollectionChangedNotifier notifier) { if (itemsSource == null) { return(new EmptySource()); } switch (itemsSource) { case IList _ when itemsSource is INotifyCollectionChanged: return(new ObservableItemsSource(itemsSource as IList, notifier)); case IEnumerable <object> generic: return(new ListSource(generic)); } return(new ListSource(itemsSource)); }
public ObservableGroupedSource(CollectionView colView, ICollectionChangedNotifier changedNotifier) { var source = colView.ItemsSource; notifier = changedNotifier; groupSource = source as IList ?? new ListSource(source); hasGroupFooters = colView.GroupFooterTemplate != null; hasGroupHeaders = colView.GroupHeaderTemplate != null; HasHeader = colView.Header != null; HasFooter = colView.Footer != null; if (groupSource is INotifyCollectionChanged incc) { incc.CollectionChanged += CollectionChanged; } UpdateGroupTracking(); }
public static IItemsViewSource Create(IEnumerable itemsSource, BindableObject container, ICollectionChangedNotifier notifier) { if (itemsSource == null) { return(new EmptySource()); } switch (itemsSource) { case IList list when itemsSource is INotifyCollectionChanged: return(new ObservableItemsSource(new MarshalingObservableCollection(list), container, notifier)); case IEnumerable _ when itemsSource is INotifyCollectionChanged: return(new ObservableItemsSource(itemsSource as IEnumerable, container, notifier)); case IEnumerable <object> generic: return(new ListSource(generic)); } return(new ListSource(itemsSource)); }