ARTICLE

Rich Text Area in Silverlight 4 Using VS 2010 Beta - Part I

Posted by Diptimaya Patra Articles | Silverlight with C# February 21, 2010
In this article we will see Rich Text Area, which came with Silverlight 4.
Reader Level:
Download Files:
 

Introduction

In this article we will see Rich Text Area, which came with Silverlight 4.

Creating Silverlight Project

Fire up Visual Studio 2010 and create a new Silverlight Application Project. Name it as RichTextBoxSample.

RichTextSil1.gif

The following design will explain about the sample application.

RichTextSil2.gif

As you see above we have several Tool Buttons to achieve some of the Rich Text Area functionalities. In this article we will achieve the following and rest would be achieved in the Part II of this article.

1. Bold
2. Underline
3. Italics
4. Font Change
5. Font Size Change

We would add ComboBox items for Font Names and Font Sizes.

RichTextSil3.gif

For Font Names the ComboBox Items are added in XAML. Following XAML code is for your reference.

RichTextSil4.gif

Now we will add codes to the Buttons Bold, Underline and Italics as follows.

RichTextSil5.gif


RichTextSil6.gif

RichTextSil7.gif

Now on the SelectionChanged event handler of FontNames and FontSizes ComboBox we will write the below code.

RichTextSil8.gif

Now we are ready to run the application for the above tools in Rich Text Area.

RichTextSil9.gif

Now we will apply the above styles in the Rich Text Area.

RichTextSil10.gif

In Part II we will see other functionalities and new too.

Hope this article helps.

COMMENT USING
Employers - Post Free Jobs