The eagerly awaited release of Silverlight 4.0 is now a fact and we have great news to share with you. Here at Telerik we are going to have a new addition to our Silverlight suite – a brand new native Silverlight 4.0 rich text box. RadRichTextBox offers MS Word-like text editing and formatting capabilities which come with unmatched performance, paged and flow layout. The new control utilizes UI Virtualization and Recycling, easy to use API for accessing/modifying document and layout structure, and more. A CTP of RadRichTextBox is going to be released with the upcoming RadControls for Silverlight 2010.Q1 SP1. The official version is expected to be part of the Q2 2010 release.
To illustrate better some of the new features let’s see a short example of the document model in pure
As we said above, the structure of the document is like the documents in WPF. In the XAML on the left you can see a RadDocument, in which is added a section, in the section – a few paragraphs and in the paragraphs – some spans.
If we look at the standard ribbon bar of MS Word, we are currently supporting the following formatting capabilities (surrounded with red rectangles in the image):
Some of the other features provided in RadRichTextBox are:
Import/export in .txt/.xaml formats,
Multi-level Undo/Redo Support,
Two type of layout – Paged and Flow (as text in an HTML page viewed in a browser),
Multi-region selection, on which you can apply formatting operations,
Deleting, Copy/Paste in plain text (using Silverlight 4.0 build in clipboard),
Copy/Paste in internal rich-text clipboard.
Here is an example of the Flow Layout Mode of RadRichTextBox.
Performance and Memory Usage
As a native Silverlight 4.0 rich text editor, RadRichTextBox is developed with two major goals in mind - performance and memory usage. We did our best to provide performance that allows handling of very large documents – over 500+ MS Word A4 pages, while the memory footprint is very small and remains unnoticeable changed when editing. To achieve this we have developed our own multithreaded layout system, efficient data structures, and again our own custom font measurement system. RadRichTextBox is 100% virtualized with recycled UI – this means that we create only the UI objects which are visible and the same elements are reused when scrolling through the document.
Some of the APIs that RadRichTextBox exposes are for accessing both document structure and document layout model, for editing, for controlling the caret, getting feedback on the format of the text at the caret position, controlling the selection and much more.
Below is an example how to create a simple document trough C#:
And the result is:
Our plans for the future are to add support for images/hyperlinks; multilevel bullets and numbering; search and replace; predefined styles; mail merge; more import/export formats like: HTML, DOCX, RTF, PDF, XPS; tables support and everything you might expect from a Silverlight word processor.
We are open to feedback from you and we’ll consider any suggestions for further improvements. You will be able to play with it very soon when our RadControls for Silverlight 2010.Q1 SP1 is released.
Hope you will have great projects using our new control!