0
votes

I am working on a News Application on WP8.1 and news body text is formatted as rtf. And below is a sample body text of a news item. But I cannot display body text as formatted before in Windows Phone.

{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;\red255\green255\blue0;} \viewkind4\uc1\pard\ltrpar\sl276\slmult1\cf1\highlight2\lang2055\ul\b\f0\fs20 Test for \highlight3 RTF\highlight0 RTF TEST TETST \par \highlight3 www.google.com\highlight0\par \pard\ltrpar\cf0\lang1033\ulnone\b0\f1\fs17\par }

How can I display rtf above in WP ? Thanks in advance.

1

1 Answers

0
votes

A Windows Phone Runtime app can display RTF in a RichEditBox:

RichEditBox1.Document.SetText(TextSetOptions.FormatRTF,rtfString);

See Quickstart: Adding text input and editing controls and the XAML text editing sample for more info.

There isn't an in-box RTF control for Silverlight apps, but for simple RTF you can parse it yourself and then load the blocks into a RichTextBox.