In this topic you'll add spell-checking to your application. This topic assumes you have added a C1RichTextBox control and a C1RichTextBoxMenu control to your page.
In this help topic, you'll use an English dictionary resource. If you wish to use a different dictionary, you may choose any from the 22 supported dictionaries.
The main steps for adding spell-checking are to declare a new C1SpellChecker, load the Main Dictionary of your choice, and to assign C1SpellChecker to the SpellChecker property of your C1RichTextBox.
XAML Markup |
Copy Code
|
---|---|
<c1RTB:C1RichTextBoxMenu x:Name="rtbMenu" RichTextBox="{Binding ElementName=rtb}"/> <c1RTB:C1RichTextBox x:Name="rtb" BorderThickness="2" BorderBrush="DarkGray" /> |
C# |
Copy Code
|
---|---|
using C1.Xaml.SpellChecker; using C1.Xaml.RichTextBox; |
C# |
Copy Code
|
---|---|
rtb.Text = @"Some facts about Mark Twain (spelling errors intentional ;-) A steambat pilot neded a vast knowldege of the ever-chaging river to be able to stop at any of the hundreds of ports and wood-lots along the river banks. Twain meticulosly studied 2,000 miles (3,200 km) of the Mississipi for more than two years before he received his steamboat pilot license in 1859.";
|
C# |
Copy Code
|
---|---|
var spell = new C1SpellChecker(); |
C# |
Copy Code
|
---|---|
rtb.SpellChecker = spell; |
C# |
Copy Code
|
---|---|
Assembly asm = typeof(MainPage).GetTypeInfo().Assembly; Stream stream = asm.GetManifestResourceStream("YourApplicationName.Resources.C1Spell_en-US.dct"); |
C# |
Copy Code
|
---|---|
spell.MainDictionary.Load(stream); |
In this topic, you added text to your C1RichTextBox control, and then added some code to handle spell-checking.