or
public static void PrintHeaderedContentControl(HeaderedContentControl VisualToPrint) { PrintDialog myPrintDialog = new PrintDialog(); if (myPrintDialog.ShowDialog() == true) { myPrintDialog.PrintVisual(VisualToPrint, VisualToPrint.Header.ToString()); } } // PrintHeaderedContentControlIf 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.Measure(pageSize); ControlToPrint.Arrange(new Rect(10, 10, pageSize.Width - 10, pageSize.Height - 10)); myPrintDialog.PrintVisual(ControlToPrint, Title); ControlToPrint.LayoutTransform = transOld;
RadRichTextBox radRichTextBox = ((RadRichTextBoxAutoComplete)currentPane).radRichTextBox;//Set Custom AnnotationItemGroupRangeEnd rangeEnd = new ItemGroupRangeEnd();ItemGroupRangeStart rangeStart = (ItemGroupRangeStart)rangeEnd.CreatePairedStart();rangeStart.Name = "GroupItem " + count++;//Place annotation around newly inserted textradRichTextBox.Document.InsertCustomAnnotationRange(radRichTextBox.Document.CaretPosition, radRichTextBox.Document.CaretPosition, rangeStart, rangeEnd);//Referesh editorradRichTextBox.UpdateEditorLayout();public override bool SkipPositionBefore{ get { return false; }}<telerik:RadTreeView telerik:StyleManager.Theme="Metro" SelectedItem="{Binding SelectedNomenclatuurnummer, Mode=OneWayToSource}" Margin="10,5" IsTriStateMode="True" IsOptionElementsEnabled="True" SelectionMode="Multiple" ItemsOptionListType="CheckList" ItemsSource="{Binding Nomenclatuurnummers}" HorizontalAlignment="Stretch" Grid.RowSpan="4" Grid.Column="1"> </telerik:RadTreeView>