'How to display non printable characters (ASCII codes 0 - 32) in WPF

I want to display and edit serial data (e.g. NULL, STX, ETX, ENQ, etc. characters) in the text box in WPF. It should be displayed same like Notepad++ as shown here.

Control Characters

I have tried using textbox, RichTextBox in WPF, but only printable characters are shown. Non printable characters (e.g. NULL, STX, ETX, ENQ, etc. characters) are not shown. Will you please guide me how can I display this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source