Search code examples
wpfbehaviorflowdocumentrichtext

Semi-rich formatted text display options in WPF


My WPF application has content displayed on a panel. The content will be authored content, hence it has to be somewhat standards compliant (like HTML or markdown or maybe even XAML etc.) The content will have formatted text, such as bold, italic and it can have hyperlinks and tooltips.

My questions:

  1. What would be the appropriate text format to use?
  2. And what will be the best option to implement behaviors? I tried using RTF, but how do I open the browser when the user clicks on a url within the RTF?

Solution

  • Have you tried hosting the text in a RichTextBox? This uses XAML to back the text but there are conversions to RTF or HTML. The article Mastering the WPF RichTextBox may be useful.