Step 2 of 3: Adding Spelling Checking

In the previous step you created a new Silverlight application, set the application up, and added the C1RichTextBox and C1RichTextBoxToolbar controls to the application. If you currently click the Spell Check button in the toolbar at run time, you'll receive a message that spell checking is currently not set up. In this step you'll customize the application further and add spell-checking functionality to the application.

Complete the following steps:

1.   In the Solution Explorer, right-click the .Web project and select Add | Existing Item. The Add Existing Item dialog box will appear.

2.   In the Add Existing Item dialog box locate the C1Spell_en-US.dct file included in the RichTextBoxSamples sample folder. By default, it should be installed in the Documents or My Documents folder in ComponentOne Samples\Studio for Silverlight 4.0\C1.Silverlight.RichTextBox\RichTextBoxSamples\RichTextBoxSamples.Web.

This is a US English dictionary file – if you add another file, instead, you can adapt the steps below with the appropriate code.

3.   In the Solution Explorer, right-click the MainPage.xaml file and select View Code to open the code file.

4.   In the Code Editor, add the following code to import the following namespaces:

      Visual Basic

      C#

5.   Add code to the MainPage constructor so that it appears similar to the following:

      Visual Basic

      C#

This code adds spell-checking – including as-you-type spell-checking – to the application.

6.   Add the following code to the MainPage constructor, under the code you just added:

      Visual Basic

      C#

This code adds content to the C1RichTextBox control. Note that the misspellings in the text are deliberate.

 What You've Accomplished

In this step you added content and spell-checking to your C1RichTextBox application. Now that you've customized the application is to run it. In the next step you'll run the application and view some of the run-time interactions possible with the C1RichTextBoxToolbar and C1RichTextBox controls.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.