So I have been building a WPF application that prints over some forms. These forms come preprinted with only blank spaces where you are supposed to write in some information. WPF app needs to precisely print text so that text printed by WPF aligns perfectly with text and blanks in preprinted form. And by using DocumentViewer and FixedDocument I was able to largely succed at the task.
The big bugbear was that for some reason VS WPF designer doesn't like when you put PageContent into FixedDocument in DocumentViewer even though you can put PageContent in any other container (like Scroll Viewer) and it would get rendered perfectly. But even if VS XAML parser was being incoperative I could compile and run my app with no problems.
Problems on the other came from my inability to find a way to hide some elements in FixedDocument from printing. In order for the user to enter information into the app more preciselly and to know where in the printed form I would place that info, I put the scanned image of the form in the background of the FixedDocument. But I only want it to be displayed when the user is viewing the document in the DocumentViewer, I don't want that image to be printed when he presses print button.
Now in Windows forms I could handle OnPrint event and using IsPrintPreview property I could decide what to print and what not to. DocumentViewer on the other hand seemingly doesn't allow me to decide what to print and what not to print.
Soooo, long story short, is there a way to hide certain controls in a FixedDocument from printing in DocumentViewer?