What is the best substitute for FlowDocument in Si

2019-01-28 02:09发布

问题:

I'm porting an application from WPF to Silverlight and was saddened to read of the lack of FlowDocument support.

What is the best way in Silverlight then to display text with markup?

I just need the basics, e.g.

  • bold
  • italic
  • hyperlink
  • colors
  • font sizes

Added:

I don't mean a RichTextBox (as in the Vectorlight demo) but a way to format text on the application surface itself, like I can do with FlowDocument in WPF:

alt text http://www.deviantsart.com/upload/qna172.png

回答1:

In Silverlight 3 Vectorlight's Free RichTextBox can do a pretty good job of what you need using HTML.

In Silverlight 4 you have the option of using the RichTextBox to represent your content.



回答2:

If you do get something like that up and running, msg me and maybe we can collaborate on bringing my "BindableFlowDocument" into the world of Silverlight. ;)

edit - wow, I must have gotten mixed up - my original answer was way off



回答3:

Inline with the comments of SL4 RC's RichTextBox (RichTextArea, circa SL4 Beta), and with your example of importing marked up text, the SL4 RC RichTextBox will allow for an import of XAML formatted text - like string richText = MyRichContent.Xaml; on this page: http://timheuer.com/blog/#richtextbox. Details are listed here: http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.xaml(VS.96).aspx.



回答4:

Just use the RichTextBox in Silverlight 4.0