Posted 28 January 2022, 9:51 am EST
Hello,
I have a test application that uses C1PdfViewer.
I have outsourced the C1PdfViewer into a sample user control UserControl1.
When using only one instance of UserControl1 in my application, everything works as expected (i can scroll, search in pdf …).
As soon as I add a second, third, fourth … instance of UserControl1 in another tab, the first one works as expected, but all the others throw an exception when I scroll down some pages.
I have included my test PDF in the root folder, next to the solution. To open a pdf in the active tab, you need to enter the path to the test PDF in the textbox labeled “PDF-Pfad” and click on the button “PDF öffnen” afterwards.
If you load the pdf in Tab 1 and scroll to the bottom, everything works fine. If you do the same in Tab 2 or 3, the following exception gets thrown and my application crashes:
System.NullReferenceException
HResult=0x80004003
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=C1.WPF.PdfViewer.4.5.2
StackTrace:
at C1.WPF.PdfViewer.C1PdfViewer.RaisePropertyChanged(String propertyName)
at C1.WPF.PdfViewer.C1PdfViewer.OnVerticalOffsetChanged(Object sender, EventArgs e)
at C1.WPF.C1ListViewer.RaiseVerticalOffsetChanged()
at C1.WPF.C1ListViewer.OnVerticalOffsetChanged()
at C1.WPF.C1ListViewer.<>c.<.cctor>b__18_2(DependencyObject d, DependencyPropertyChangedEventArgs a)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
How can I use multiple instances of C1PdfViewer without getting that exception when scrolling some pages further down?
Note: I must not use C1FlexViewer, because it lacks of functionality or has some deal-breaker bugs, for example: https://www.grapecity.com/forums/wpf-edition/c1flexviewer---search-with
I am using the following C1 assemblies:
- "* “C1.WPF.4.5.2.dll”
- “C1.WPF.Document.4.5.2.dll”
- “C1.WPF.PdfViewer.4.5.2.dll”
- “C1.WPF.Zip.4.5.2.dll”
"
WPF_Forschung_PDF_ComponentOne - 25.01. TICKET.zip