Print PopUp with textblocks and datagrid RRS feed

  • Question

  • I have few textblocks and a scrollable datagrid , when i try the Print it prints the visible area only.

    How can i print textblocks and the complete information on the grid

    Friday, August 6, 2010 4:27 PM


All replies

  • cant simply do this?

    var mydoc = new PrintDocument(); 
       mydoc.DocumentName = myocumentName;

       mydoc.PrintPage += (s, e) => 
            e.PageVisual = theDataGrid; 

    Friday, August 6, 2010 4:53 PM
  • Well that would just print the datagrid , and i have some textblocks and other controls on the pop up i need along with the grid.  

    Monday, August 9, 2010 9:55 AM
  •  Hi,

         The PageVisual property can take an UIElement as it's content

         You may wrap all you need inside a stackpanel and then print.

    Best Regards

    Tuesday, August 10, 2010 1:41 AM
  • I did wrap every thing in a stack panel

    the only issue is that my datagrid has a scrollbar and when i print i actually can only print the visualPage. The hidden rows are missing. Is there a way to print the complete datagrid and the textblock which are in a stackpanel

    Tuesday, August 10, 2010 9:16 AM
  • Hi,

       Oh, I see the problem here.

       SL will only capture the Visual parts to print.

       The only workaround is to build your own print control. And fill it with the same datasource as datagrid. 

       But this may require you to page your contents and print.


    BEst REgards 

    Tuesday, August 10, 2010 10:41 PM