/// <summary> /// Initializes a new instance of the <see cref="DomainCollectionView"/> /// </summary> /// <param name="collectionViewLoader">The <see cref="CollectionViewLoader"/> to use for loading data</param> /// <param name="source">The source collection for this view. All updates to the /// source will be reflected in the view. /// </param> public DomainCollectionView(CollectionViewLoader collectionViewLoader, IEnumerable source) { if (collectionViewLoader == null) { throw new ArgumentNullException("collectionViewLoader"); } if (source == null) { throw new ArgumentNullException("source"); } this._collectionViewLoader = collectionViewLoader; this._collectionViewLoader.CanLoadChanged += this.OnCollectionViewLoaderCanLoadChanged; this._collectionViewLoader.LoadCompleted += this.OnLoadCompleted; this.CollectionView = DomainCollectionView.CreateView(source); this.EditableCollectionView = this.CollectionView as IEditableCollectionView; if (this.EditableCollectionView == null) { throw new InvalidOperationException(Resources.MustImplementIecv); } this.PagedCollectionView = new DomainPagedCollectionView(this.LoadPage); this.SetPageIndex(this.PagedCollectionView.PageIndex); this.CalculateAll(); }