private void CreateNewItemsSource() { TimeSpan timeout = TimeSpan.FromSeconds(2); if (virtualPDFPages != null) { virtualPDFPages.CleanUpAllPages(); } virtualPDFPages = new AsyncVirtualizingCollection <IEnumerable <PDFImage> >(imageProvider, parent.GetPagePer(), timeout); itemsControl.ItemsSource = virtualPDFPages; }
public void Unload() { scrollViewer.Visibility = System.Windows.Visibility.Collapsed; scrollViewer.ScrollToHorizontalOffset(0); scrollViewer.ScrollToVerticalOffset(0); imageProvider = null; if (virtualPDFPages != null) { virtualPDFPages.CleanUpAllPages(); virtualPDFPages = null; } itemsControl.ItemsSource = null; }