Reputation: 380
I've got a gridview containing several lines (~20-30) and a few columns (4-5) and I want to print it's content. I've tried using the PrintDialog' PrintVisual method, something like:
private void PrintBtn_Click(object sender, RoutedEventArgs e)
{
PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() == true)
{
printDialog.PrintVisual(grid, "My First Print Job");
}
}
Of course, it didn't work fully, as it prints only the visible rows in the screen. How can I print the full contents???
Upvotes: 0
Views: 1043
Reputation: 16618
Printing in WPF is not trivial. Far from it actually.
I recommand using SUT.PrintEngine then you can do stuff like:
public static void PrintElement(FrameworkElement _PrintMe)
{
var suPrintVm = PrintControlFactory.Create(_PrintMe);
suPrintVm.ShowPrintPreview();
}
Upvotes: 2