With this tool you can convert rich text to Xml in a xml document structure which is compatible to Xaml. Additionaly I created a freeSilverlight 4 UserControl, the RichXamlViewer, that you can use to display the text (which before was converted to Xml) in a Silverlight 4 application. But you can also use the regular Silverlight 4 RichTextBox control to display the text which was converted to Xml. Please visit my blog (english or german) to see how it works. So, as the result, you can use the converted Xml as Xaml source for a Silverlight 4 RichTextBox control or for my free RichXamlViewer UserControl. The RichTextBox.Xaml Builder and the RichXamlViewer are created both to work hand in hand. This is, how this tool works togetherwith the Silverlight 4 RichXamlViewer UserControl work together: 1. Use RichTextBox.Xaml Builder to convert some rich text to xml. 2. Save the converted text with RichTextBox.Xaml Builder as a Xml file, e.g. "MyRichXamlSource.xml". 3. Download the free RichXamlViewer at the Expression Gallery. 4. Add the RichXamlViewer to a new Silverlight 4 Project. 5. Add the xml file to the Silverlight 4 project. Set build status to "content". 6. Set the XamlSource property of the RichXamlViewer to the xml file name, in the given example to "MyRichXamlSource.xml". Run the project and the text is displayed like it was formatted as rich text. The RichXamlViewer Silverlight 4 UserControl has a quite useful zoom feature. It has a ZoomPad integrated in the UI which can be used to zoom the displayed text simply by scrolling the mouse wheel. You can view an example and download the RichXamlViewer UserControl at the Expression Gallery. To use a xml file which was created with the RichTextBox.Xaml Builder with a regular Silverlight 4 RichTextBoxdo the following: 1. Use the RichTextBox.Xaml Builder to convert rich text to xml and to save it in a .xml file. Add the .xml file as described above to a Silverlight 4 project. 2. Add a regular Silverlight 4 RichTextBox to the Silverlight 4 project. Name the RichTextBox, e.g. "MyRTB". 3. Add the following code snippet, e.g. to the MainPage_Loaded event handler:
Visual Basic MyRTB.Xaml = XElement.Load("MyRichXamlSource.xml").ToString(SaveOptions.DisableFormatting) Run with F5 and that's it. Visit my english blog or my german blog to get further information. Update:You can download this tool now also as Click-Once-Application.
Please note: This version of RichTextBox.Xaml Builder has two limitations. Second, in this version only Paragraph, Span and Run elements are built. Hyperlink and InlineUIContainer are not supported. But Bold, Italic and Underline are formatted correctly. |