简体   繁体   中英

How to Load or Bind RTF file and dispaly it in Silverlight RichTextBox or RichTextBoxOverflow

I´m writing my first application in Silverlight and I want to load text from RTF File and display it in RichTextBlock Control.

In this Silverlight control is not Text property or LoadFile property like was in WinForms Rich TextBox.

Please does anybody know how to load or bind some RTF file and visualize it in Silverlight without external toolkits??

Thanks a lot!

Silverlight does not support the RTF format. The Silverlight RichTextBox only has a Xaml property to which you can assign rich text that is already in Xaml format.

In order to load RTF you would need to code to load and parse the RTF file into a Xaml string suitable for assignment to the RichTextBox . There is no simple way to do this, even with third party the help like NRTFTree . You would still need to walk the generated tree to encode it to Xaml.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM