private void _OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) { if (args.Action == NotifyCollectionChangedAction.Add) { if (args.NewItems.Count != 1) { throw new NotSupportedException(SR.Get(SRID.RangeActionsNotSupported)); } else { // get the affected item object item = args.NewItems[0]; DocumentsTrace.FixedDocumentSequence.Content.Trace(string.Format("_OnCollectionChange: Add {0}", item.GetHashCode())); AddLogicalChild(item); int pageCount = this.PageCount; DynamicDocumentPaginator paginator = GetPaginator((DocumentReference)item); if (paginator == null) { throw new ApplicationException(SR.Get(SRID.DocumentReferenceHasInvalidDocument)); } int addedPages = paginator.PageCount; int firstPage = pageCount - addedPages; if (addedPages > 0) { DocumentsTrace.FixedDocumentSequence.Content.Trace(string.Format("_OnCollectionChange: Add with IDP {0}", paginator.GetHashCode())); _paginator.NotifyPaginationProgress(new PaginationProgressEventArgs(firstPage, addedPages)); _paginator.NotifyPagesChanged(new PagesChangedEventArgs(firstPage, addedPages)); } } } else { throw new NotSupportedException(SR.Get(SRID.UnexpectedCollectionChangeAction, args.Action)); } }