Monday, March 29, 2010

Silverlight 4 RC - RichTextBox (the control formerly known as RichTextArea)

Silverlight 4 introduced a new control for enabling editing and display of rich text. (See original details here for RichTextArea.) A few things have changed here, one key one being the name: RichTextBox. This was to be more consistent with WPF and also based on your feedback. Additional improvements were also enabling the ability to get the XAML that makes up the underlying runs and paragraph of the rich text. This is helpful for saving off the data and re-hydrating later if desired. It’s a simple property on the RichTextBox control (assuming the control name is ‘MyRichContent’):

   1: string richText = MyRichContent.Xaml;

In addition to that, there are also some new text selection and position APIs to enable you programmatically select text and/or know where the current position of the text is located. This is best demonstrated in the ‘Silverlight Notepad’ sample application in the hands-on-lab area where you can see examples of it being used.


Source : http://timheuer.com/blog/archive/2010/03/15/whats-new-in-silverlight-4-rc-mix10.aspx


1 comment: