I have a TextBox control in my Metro app and need to be able to simply print its contents. I have done my research ever since Windows 8 Dev Preview was around and I still cannot figure it out.
I've tried samples, read other answers and read the documentation - over, and over, and over. It just doesn't seem possible. So, after what, 2 years? I'm offering all my reputation (well, as much as they'll allow) in the hopes that someone can help me.
Here I have created a simple helper class which help you to print the
Textbox
content with its formatting. You just need to call static method of classPrinter
. The project on GitHub also contain test app.PrintPreview
is a canvas, which is mandatory to show print preview in device charm. You have to declare in your XAML.MyTextBox
is a text box object, whose text content is going to be printed.Guid.NewGuid().ToString()
is a file name for printing the document. (It will be applied if you are creating PDF or XPS file via printing.)You can add helper class via NuGet. If you want to enhance my existing helper class, fork on GitHub