This question is locked. New answers and comments are not allowed.
Hi,
I would like to print two grids one after the other with pagination if needed. The best I have got so far is to have one grid on top of another.
Ive tried to set the Canvas.SetTop of the second grid _commentGrid but I havent had any success.
Ive also tried using a StackPanel instead of and within the canvas and it doesn't render anything in the printout.
If you could let me know how to print two grids one after the other I would greatly appreciate it.
Regards,
Joe
I would like to print two grids one after the other with pagination if needed. The best I have got so far is to have one grid on top of another.
Ive tried to set the Canvas.SetTop of the second grid _commentGrid but I havent had any success.
Ive also tried using a StackPanel instead of and within the canvas and it doesn't render anything in the printout.
private
void
PrintWeek1_Click(
object
sender, RoutedEventArgs e)
{
_offsetY = 0d;
_totalHeight = 0d;
CreateLocationPrintGrid();
CreateCommentsPrintGrid();
var doc =
new
PrintDocument();
_canvas =
new
Canvas();
_canvas.Children.Add(_locationGrid);
_canvas.Children.Add(_commentGrid);
doc.PrintPage += DocPrintPage;
doc.Print(
"RadGridView print"
);
}
void
DocPrintPage(
object
sender, PrintPageEventArgs e)
{
e.PageVisual = _canvas;
if
(_totalHeight == 0)
{
_totalHeight = _locationGrid.DesiredSize.Height +_commentGrid.DesiredSize.Height;
}
Canvas.SetTop(_locationGrid, -_offsetY);
_offsetY += e.PrintableArea.Height;
e.HasMorePages = _offsetY <= _totalHeight;
}
}
If you could let me know how to print two grids one after the other I would greatly appreciate it.
Regards,
Joe