Customizing Header/Footer while printing diagram

I am unable to add text in header / footer when i use custom PrintManager.
If i remove custom class its showing my header / footer text. But unable to have In-place print preview.

How can I add my own text in header/footer, could you please help with a sample.

Are you using the PreviewingPrintManager defined in the EntityRelationship sample? Does that class do what you want in that sample? What changes have you made to that class in your app?

Yes m using same PreviewingPrintManager class shown in ER sample without making any changes…

using template to test header

    <DataTemplate x:Key="PrintBorderTemplate">
        <go:SpotPanel>
            <TextBlock Text="CUSTOM HEADER" FontSize="30"  go:SpotPanel.Spot="MiddleTop" go:SpotPanel.Alignment="MiddleBottom" />
        </go:SpotPanel>
    </DataTemplate>

    <go:Diagram x:Name="myDiagram" >
        <go:Diagram.PrintManager>
            <go:PrintManager ForegroundTemplate="{StaticResource PrintBorderTemplate}"
                Margin="30 70 30 70" />
        </go:Diagram.PrintManager>
    </go:Diagram>

So you are saying that the XAML that you just quoted works, but that if you replace go:PrintManager with local:PreviewingPrintManager, it doesn’t work?

yes its NOT working. if i remove PreviewingPrintManager it works.

Kindly help with a sample.

Yes, that is because the initialization of the PreviewingPrintManager replaces the DIagram.PrintManager with itself, so whatever you specified in XAML is being thrown away:

  public class PreviewingPrintManager : PrintManager {
    // Setup this Diagram.PrintManager to automatically update the "Print Grid".
    public void Init(Diagram diagram) {
      diagram.PrintManager = this;
      . . .

Do this initialization instead:

(myDiagram.PrintManager as PreviewingPrintManager).Init(myDiagram);

I m getting
Object reference not set to an instance of an object. exception
if do initialize

        (myDiagram.PrintManager as PreviewingPrintManager).Init(myDiagram);

instead of

        new PreviewingPrintManager().Init(this.myDiagram);

Are you not doing what you said was not working, setting Diagram.PrintManager to an instance of PreviewingPrintManager in XAML?

Thank you for your help…
resolved it