Hi,
I am using PdfViewer and do some modification on the toolbar (adding custom stamps). Everything works fine so far.
But after adding a dockingManager to my ChromelessWindow I get a System.NullReferenceException while the toolbar is modified by my code.
Dim toolbar As DocumentToolbar = TryCast(pdfViewer.Template.FindName("PART_Toolbar", pdfViewer), DocumentToolbar)
Dim stampButton As ToggleButton = CType(toolbar.Template.FindName("PART_Stamp", toolbar), ToggleButton)
Dim customMenuItem As MenuItem = CType(stampButton.ContextMenu.Items(1), MenuItem)
The exceptions is because toolbar is nothing in line 2.
The
System.NullReferenceException occurs ONLY if I NOT call dockingManager.LoadDockState().
If
dockingManager.LoadDockState() is called, it works fine.
What I am doing wrong?
Thank you for your help.
Marco