How do you load and save content from a Silverlight 4 RichTextBox control?

Posted by AnthonyWJones on Stack Overflow See other posts from Stack Overflow or by AnthonyWJones
Published on 2010-01-20T16:34:10Z Indexed on 2010/03/16 22:31 UTC
Read the original article Hit count: 1063

I've been reviewing the features of the RichTextBox control in Silverlight 4.

What I've yet to find is any examples of Loading and Saving content in the RichTextBox.

Anyone come across any or can shed some light on it?

The control has a BlocksCollection in which I guess one could use the XamlReader to load a bunch of markup assuming that markup has a single top level node of type Block. Then add that block to the Blocks collection. Seems a shame that the RichTextBox bothers to have a "collection" in this case, why not simply a top-level Block item?

Never-the-less that still leaves saving the content of a RichTextBox, I have no idea where to begin with that one?

I'm sure I must be missing the obvious here but unless loading and saving data in to and from RichTextBox is at least possible if not easy I can't see how we can actually put it to use.

Edit

Thanks to DaveB's answer I found discussion of something called the DocumentPersister. However no reference to this class can be found in the MSDN documentation nor can I find it in the installed dlls via object browser search. Anyone, anyone at all?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-4.0