This is a migrated thread and some comments may be shown as answers.

Print Dialog

1 Answer 175 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adam Marshall
Top achievements
Rank 1
Adam Marshall asked on 05 Mar 2012, 02:21 AM
Hi,

I am printing GridView's and TreeListViews using the PrintAndExportWithRadDocumentModel.cs code, which I found on the forum somewhere.


public void Print(object parameter)
     {
         GridViewDataControl grid = (GridViewDataControl)parameter;
         RadRichTextBox rtb = new RadRichTextBox() { Height = 0 };
 
         rtb.Name = "RadRichTextBox1";
 
         Grid parent = grid.ParentOfType<Grid>();
         if (parent != null && parent.FindName(rtb.Name) == null)
         {
             parent.Children.Add(rtb);
             rtb.ApplyTemplate();
         }
 
         rtb.Dispatcher.BeginInvoke((Action)(() =>
         {
             rtb.Document = CreateDocument(grid);
         }));
          
         rtb.Print("MyDocument", Telerik.Windows.Documents.UI.PrintMode.Native);
     }

I need to be able to hide the PrintDialog if required, how do I achieve this using the printing functionality of the RichTextBox. Previously I was using another class  PrintExtensions.cs, but this was not able to print the TreeListView's which I need.

Thanks,

Adam


1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Mar 2012, 08:35 AM
Hello,

 No need to search the forums for this. You can find the actual working demo here. The same is available in your local copy of our WPF demos. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Adam Marshall
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or