How to print WPF Grid paged?
Posted
by Oliver Hanappi
on Stack Overflow
See other posts from Stack Overflow
or by Oliver Hanappi
Published on 2009-09-08T07:17:41Z
Indexed on
2010/04/01
12:13 UTC
Read the original article
Hit count: 915
Hi!
I'm printing a WPF grid. As long as the data fits on one page, everything works fine. But sometimes the grid contains more data. Therefore I need to split the grid into multiple pages. Can anybody help me?
My code looks like this (visual is the grid).
var printCapabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
var size = new Size(printCapabilities.PageImageableArea.ExtentWidth,
printCapabilities.PageImageableArea.ExtentHeight);
visual.Measure(size);
visual.Arrange(new Rect(new Point(printCapabilities.PageImageableArea.OriginWidth,
printCapabilities.PageImageableArea.OriginHeight), size));
printDialog.PrintVisual(visual, "Print ListView");
Should I try another control? I've tried WPF Toolkit DataGrid, but I couldn't manage to get it printed. I've heard something of a flow document, can this help me?
Best Regards
Oliver Hanappi
© Stack Overflow or respective owner