Using The Built-In Print Dialog Box

Windows Presentation Foundation User's Guide > Howto: Print

Sending a file to the printer in most cases only requires a single line of code. The TextControl.Print method will open a dialog box to let the user select a printer and all required options.

This code sample will open a print dialog box, and, if the user clicks OK, print the document:

private void MenuItem_Click(object sender, RoutedEventArgs e)
    textControl1.Print("My Print Job");
[Visual Basic]
Private Sub MenuItem_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    TextControl1.Print("My Print Job")
End Sub