WPF DataGrid Printing Scrolled Visuals
Posted
by RichS
on Stack Overflow
See other posts from Stack Overflow
or by RichS
Published on 2010-03-05T16:43:50Z
Indexed on
2010/06/10
0:42 UTC
Read the original article
Hit count: 1004
I've been using the DataGrid (from WPF Toolkit), and have successfully created all of my data.
The next step is that I want to print the entire DataGrid (scaled to a single printed page), even though the visible DataGrid in my Window is currently scrolled.
When I prepare the DataGrid for printing, I've tried setting the DesiredSize to PositiveInfinity, and then calling Measure(.), to get the needed size of the DataGrid. But, when I call Arrange(.), it only prints the part of the DataGrid control that is currently visible on-screen. I know how to scale it to the correct size, but can't get the non-visible part of the DataGrid to be output to the printer.
I've tried rendering to a Bitmap (RenderTargetBitmap), but that has the same problem. I also tried setting the MinHeight and MinWidth to be the same as the DesiredSize to try to /force/ things. But that doesn't work either.
All I ever see in my printed page, is what was visible on-screen.
Does anyone know how to solve this?
© Stack Overflow or respective owner