I was trying my hands on Silverlight 4 Beta version and found this is wonderful control - RichTextBox.. This was much needed on Web Platform and Microsoft has really made it work simple... Rather, thanks to the invention of XAML!
This small control supports many features. Some of them are:
- Formatting of text at runtime - font, color, bold, italics, underline, etc.
- Addition of inline UI Elements in the Text Box itself.
- Read / Write only modes both supported.
- Hyperlinks can also be inserted in the text.
Let's do some scripting. Two ways to work:-
Way 1: Texting through XAML
Way 2: Texting through C# Code
// Create a Run of plain text and some bold text.
Run myRun1 = new Run();
myRun1.Text = "This is a ";
Bold myBold = new Bold();
Run myRun2 = new Run();
myRun2.Text = "text.";
// Create a paragraph and add the Run and Bold to it.
Paragraph myParagraph = new Paragraph();
// Add the paragraph to the RichTextArea.
//Add the RichTextArea to the StackPanel.
Hope this helps!