How to print a RadPane?

2 posts, 0 answers
  1. Pieter
    Pieter avatar
    34 posts
    Member since:
    Jan 2011

    Posted 22 May 2012 Link to this post

    I'm trying to print a RadPane using the following code:
    public static void PrintHeaderedContentControl(HeaderedContentControl VisualToPrint)
                PrintDialog myPrintDialog = new PrintDialog();
                if (myPrintDialog.ShowDialog() == true)
                    myPrintDialog.PrintVisual(VisualToPrint, VisualToPrint.Header.ToString());
            } // PrintHeaderedContentControl

    If I try this with PrintHeaderedContentControl(myRadPane) I just get an empty page with only the header text.
    Any Ideas what I can do get this to work?
    the following the following


    It turned out the control was printed but outside the printer paper. So we need to resize and transform the control to get it on paper with code like this:


    Transform transOld = ControlToPrint.RenderTransform;
                    TransformGroup myTransforms = new TransformGroup();
                    myTransforms.Children.Add(new ScaleTransform(dScale, dScale));
                    myTransforms.Children.Add(new TranslateTransform((myPrintDialog.PrintableAreaWidth - 20) / 20, (myPrintDialog.PrintableAreaHeight - 20) / 20));
                    ControlToPrint.LayoutTransform = myTransforms;
                    Size pageSize = new Size(myPrintDialog.PrintableAreaWidth - 20, myPrintDialog.PrintableAreaHeight - 20);
                    ControlToPrint.Arrange(new Rect(10, 10, pageSize.Width - 10, pageSize.Height - 10));
                    myPrintDialog.PrintVisual(ControlToPrint, Title);
                    ControlToPrint.LayoutTransform = transOld;


  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 23 May 2012 Link to this post

    Hi Pieter,

    Could you provide me with the xaml you have for that particular rad pane? I have an idea I'd like to test out, but I need to see the exact code block for the at pane. It seems you are only asking for the header to be cast into a string (with VisualToPrint.Header.ToString() )and therefore it will be the only thing passed to the PrintDialog method.

  3. DevCraft R3 2016 release webinar banner
Back to Top