1

I have a RichEditBox that I want to convert to a RichTextBlock. To do that, I need to convert the RTF string to an XAML string. Is it possible to do that? Are there any NuGet packages for that?

marsh-wiggle
  • 2,508
  • 3
  • 35
  • 52
Ivirius
  • 59
  • 9

1 Answers1

0

One possible way seems to be converting the RTF to HTML first and then from HTML to XAML

The RtfPipe library on GitHub has a 'ToHtml' method

using RtfPipe;

string htmlString = Rtf.ToHtml(rtfString);

Then you may use a HtmlToXamlConverter to get your XAML string

string xamlFlowDocument = HtmlToXamlConverter.ConvertHtmlToXaml(htmlString, true);
marsh-wiggle
  • 2,508
  • 3
  • 35
  • 52