Chapter 11. Output

What You’ll Learn in This Hour:

  • Printing

  • Visuals

  • Bitmaps

Up to now, we have focused almost entirely on the capability of WPF to render output to users via a graphical display. WPF has many capabilities, though, and is not limited to this single form of output. Modern software must enable users to consume their data in a variety of formats.

Making the Text Editor Print

At this point, our text editor is almost finished. One major feature is missing: printing. It turns out that printing the contents of a RichTextBox is quite easy. Let’s get to it:

  1. Open the Text Editor project in Visual Studio and open the MainWindow.xaml file.

  2. Add the following to the window’s CommandBindings:

    <CommandBinding Command="ApplicationCommands.Print"
                    Executed ...

Get Sams Teach Yourself WPF in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.