In this topic you'll add spell-checking to your application. This topic assumes you have added a C1RichTextBox control and a C1RichTextBoxToolbar control to your page and linked the two together. 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 add a dictionary and set up spell-checking.
Complete the following steps:
Documents\ComponentOne Samples\WPF.
This is a US English dictionary file – if you add another file, instead, you can adapt the steps below with the appropriate code.
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF.RichTextBox Imports C1.WPF.SpellChecker |
C# |
Copy Code
|
---|---|
using C1.WPF.RichTextBox; using C1.WPF.SpellChecker; |
Visual Basic |
Copy Code
|
---|---|
Public Sub New() InitializeComponent() Dim spell As New C1SpellChecker() spell.MainDictionary.LoadAsync("C1Spell_en-US.dct") Me.C1RichTextBox.SpellChecker = spell End Sub |
C# |
Copy Code
|
---|---|
public MainPage() { InitializeComponent(); var spell = new C1SpellChecker(); spell.MainDictionary.LoadAsync("C1Spell_en-US.dct"); this.c1RichTextBox.SpellChecker = spell; } |
This code adds spell-checking – including as-you-type spell-checking – to the application.
What You've Accomplished
In this step you added spell-checking to your C1RichTextBox application. Type in the C1RichTextBox and notice that as-you-type spell-checking is initialized and misspelled words appear with a red line underneath. If you click the Spell Check button in the C1RichTextBoxToolbar, notice that the Spelling dialog box now appears.